diff --git a/pibakery-blocks/createfolder/createfolder.json b/pibakery-blocks/createfolder/createfolder.json new file mode 100644 index 0000000..c2fb919 --- /dev/null +++ b/pibakery-blocks/createfolder/createfolder.json @@ -0,0 +1,26 @@ +{ + "name": "CreateFolder", + "text": "Create a folder %1\\nAs user: %2", + "script": "createfolder.sh", + "args": [ + { + "type": "text", + "default": "/home/pi/Documents/NewFolder", + "maxLength":0 + }, + { + "type": "menu", + "options": ["pi", "root"] + } + ], + "network": false, + "continue": true, + "type": "other", + "category":"other", + "supportedOperatingSystems": [ + "raspbian-pibakery.img", + "raspbian-lite-pibakery.img" + ], + "shortDescription":"Create a folder", + "longDescription":"If you so desire, you can choose to create a folder from your Raspberry Pi." +} diff --git a/pibakery-blocks/createfolder/createfolder.sh b/pibakery-blocks/createfolder/createfolder.sh new file mode 100644 index 0000000..54a1ba1 --- /dev/null +++ b/pibakery-blocks/createfolder/createfolder.sh @@ -0,0 +1,6 @@ +#!/bin/bash +if [ $2 == "root" ]; then + su - root -c 'mkdir "$1"' +else + sudo -u pi mkdir "$1" +fi diff --git a/pibakery-blocks/ipchange/ipchange.json b/pibakery-blocks/ipchange/ipchange.json new file mode 100644 index 0000000..2df3638 --- /dev/null +++ b/pibakery-blocks/ipchange/ipchange.json @@ -0,0 +1,36 @@ +{ + "name": "ipchange", + "text": "Setup Fixed IP\\nNetwork: %1\\nIP Address: %2\\nGateway: %3\\nDNS: %4", + "script": "ipchange.py", + "args": [ + { + "type": "menu", + "options": ["eth0", "wlan0", "wlan1"] + }, + { + "type": "text", + "default": "192.168.0.55/24", + "maxLength":0 + }, + { + "type": "text", + "default": "192.168.0.254", + "maxLength":0 + }, + { + "type": "text", + "default": "192.168.0.254", + "maxLength":0 + } + ], + "network": false, + "continue": true, + "type": "network", + "category":"network", + "supportedOperatingSystems": [ + "raspbian-pibakery.img", + "raspbian-lite-pibakery.img" + ], + "shortDescription":"Automatically Change to a Fixed IP.", + "longDescription":"This block allows you to enter a Fixed IP for your network. If you want to enter multiple Fixed IP address for eth0 and wlan0, just use this block more than once." +} diff --git a/pibakery-blocks/ipchange/ipchange.py b/pibakery-blocks/ipchange/ipchange.py new file mode 100644 index 0000000..7c3d268 --- /dev/null +++ b/pibakery-blocks/ipchange/ipchange.py @@ -0,0 +1,57 @@ +#!/usr/bin/python + +import sys, os, time + +Lantxt = """ + +interface eth0 +static ip_address=myip +static routers=mygw +static domain_name_servers=mydns +""" + +WLantxt0 = """ + +interface wlan0 +static ip_address=myip +static routers=mygw +static domain_name_servers=mydns +""" + +WLantxt1 = """ + +interface wlan1 +static ip_address=myip +static routers=mygw +static domain_name_servers=mydns +""" + +netType = sys.argv[1] +newIP = sys.argv[2] +newGW = sys.argv[3] +newDNS = sys.argv[4] + +if newIP != "": + if netType == "eth0": + ipText = Lantxt.replace("myip", newIP).replace("mygw", newGW).replace("mydns", newDNS) + elif netType == "wlan0": + ipText = WLantxt0.replace("myip", newIP).replace("mygw", newGW).replace("mydns", newDNS) + elif netType == "wlan1": + ipText = WLantxt1.replace("myip", newIP).replace("mygw", newGW).replace("mydns", newDNS) + +with open("/etc/dhcpcd.conf", "a") as ipFile: + ipFile.write(ipText) + +os.system("sudo /etc/init.d/networking restart") +time.sleep(10) +os.system("sudo /etc/init.d/networking reload") +time.sleep(10) + +# It's likely that the block following this one will be one that uses the +# internet - such as a download file or apt-get block. It takes a few seconds +# for the WiFi to connect and obtain an IP address, run the waitForNetwork shell +# script, which will loop waiting for a network connection (timeout 150 seconds) +# and continue once there is one +#os.system("chmod +x /boot/PiBakery/blocks/wifisetup/waitForNetwork.sh") +#os.system("/boot/PiBakery/blocks/wifisetup/waitForNetwork.sh") + diff --git a/pibakery-blocks/lcd-show/lcd-show.json b/pibakery-blocks/lcd-show/lcd-show.json new file mode 100644 index 0000000..36d29a0 --- /dev/null +++ b/pibakery-blocks/lcd-show/lcd-show.json @@ -0,0 +1,25 @@ +{ + "name": "lcd-show", + "text": "Screen: %1\\nRotation: %2", + "script": "lcd-show.py", + "args": [ + { + "type": "menu", + "options": ["LCD35","LCD4-800x480","LCD4","LCD5","LCD7-800x480","LCD7-1024x600","LCD28","LCD32","LCD35B","LCD43","LCD101-1024x600"] + }, + { + "type": "menu", + "options": ["0", "90", "180", "270"] + } + ], + "network": true, + "continue": true, + "type": "setting", + "category":"setting", + "supportedOperatingSystems": [ + "raspbian-pibakery.img", + "raspbian-lite-pibakery.img" + ], + "shortDescription":"Sets the Raspberry pi to work with LCD screens.", + "longDescription":"Sets the Raspberry pi to work with LCD screens. starts working after reboot" +} \ No newline at end of file diff --git a/pibakery-blocks/lcd-show/lcd-show.py b/pibakery-blocks/lcd-show/lcd-show.py new file mode 100644 index 0000000..e3f19c6 --- /dev/null +++ b/pibakery-blocks/lcd-show/lcd-show.py @@ -0,0 +1,34 @@ +#!/usr/bin/python + +import sys, os, time + +LCDVER = sys.argv[1] +ROTATE = sys.argv[2] +os.system("wget -O /home/pi/LCD-show.tar.gz http://www.waveshare.com/w/upload/4/4b/LCD-show-161112.tar.gz)" +os.system("tar xvf /home/pi/LCD-show.tar.gz -C /home/pi/") +os.system("sudo sed -i 's/sudo reboot/#sudo reboot/' /home/pi/LCD-show/LCD35-show") +os.system("sudo sed -i 's/sudo reboot/#sudo reboot/' /home/pi/LCD-show/LCD4-800x480-show") +os.system("sudo sed -i 's/sudo reboot/#sudo reboot/' /home/pi/LCD-show/LCD4-show") +os.system("sudo sed -i 's/sudo reboot/#sudo reboot/' /home/pi/LCD-show/LCD5-show") +os.system("sudo sed -i 's/sudo reboot/#sudo reboot/' /home/pi/LCD-show/LCD7-800x480-show") +os.system("sudo sed -i 's/sudo reboot/#sudo reboot/' /home/pi/LCD-show/LCD7-1024x600-show") +os.system("sudo sed -i 's/sudo reboot/#sudo reboot/' /home/pi/LCD-show/LCD28-show") +os.system("sudo sed -i 's/sudo reboot/#sudo reboot/' /home/pi/LCD-show/LCD32-show") +os.system("sudo sed -i 's/sudo reboot/#sudo reboot/' /home/pi/LCD-show/LCD35B-show") +os.system("sudo sed -i 's/sudo reboot/#sudo reboot/' /home/pi/LCD-show/LCD43-show") +os.system("sudo sed -i 's/sudo reboot/#sudo reboot/' /home/pi/LCD-show/LCD101-1024x600-show") + +os.system("sudo sed -i 's/\.\//\/home\/pi\/LCD-show\//' /home/pi/LCD-show/LCD35-show") +os.system("sudo sed -i 's/\.\//\/home\/pi\/LCD-show\//' /home/pi/LCD-show/LCD4-800x480-show") +os.system("sudo sed -i 's/\.\//\/home\/pi\/LCD-show\//' /home/pi/LCD-show/LCD4-show") +os.system("sudo sed -i 's/\.\//\/home\/pi\/LCD-show\//' /home/pi/LCD-show/LCD5-show") +os.system("sudo sed -i 's/\.\//\/home\/pi\/LCD-show\//' /home/pi/LCD-show/LCD7-800x480-show") +os.system("sudo sed -i 's/\.\//\/home\/pi\/LCD-show\//' /home/pi/LCD-show/LCD7-1024x600-show") +os.system("sudo sed -i 's/\.\//\/home\/pi\/LCD-show\//' /home/pi/LCD-show/LCD28-show") +os.system("sudo sed -i 's/\.\//\/home\/pi\/LCD-show\//' /home/pi/LCD-show/LCD32-show") +os.system("sudo sed -i 's/\.\//\/home\/pi\/LCD-show\//' /home/pi/LCD-show/LCD35B-show") +os.system("sudo sed -i 's/\.\//\/home\/pi\/LCD-show\//' /home/pi/LCD-show/LCD43-show") +os.system("sudo sed -i 's/\.\//\/home\/pi\/LCD-show\//' /home/pi/LCD-show/LCD101-1024x600-show") + +os.system("sudo /home/pi/LCD-show/"+ LCDVER + "-show " + ROTATE) +os.system("sudo apt-get install -y xinput-calibrator") diff --git a/pibakery-blocks/sambamount/sambamount.json b/pibakery-blocks/sambamount/sambamount.json new file mode 100644 index 0000000..9b930e6 --- /dev/null +++ b/pibakery-blocks/sambamount/sambamount.json @@ -0,0 +1,50 @@ +{ + "name": "sambamount", + "text": "Add SAMBA Share\\nFolder Path: %1\\nLocal Path: %2\\nUsername: %3\\nPassword: %4\\nDomain: %5\\nFile Mode: %6\\nDir Mode: %7\\n", + "script": "sambamount.py", + "args": [ + { + "type": "text", + "default": "//server/public", + "maxLength":0 + }, + { + "type": "text", + "default": "/home/pi/NetworkPublic", + "maxLength":0 + }, + { + "type": "text", + "default": "username", + "maxLength":0 + }, + { + "type": "text", + "default": "password", + "maxLength":0 + }, + { + "type": "text", + "default": "DOMAIN.LOCAL", + "maxLength":0 + }, + { + "type": "menu", + "options": ["0777", "0664"] + }, + { + "type": "menu", + "options": ["0777","0775"] + } + ], + "network": false, + "continue": true, + "type": "network", + "category":"network", + "supportedOperatingSystems": [ + "raspbian-pibakery.img", + "raspbian-lite-pibakery.img" + ], + "shortDescription":"Automatically connect to SAMBA network Share.", + "longDescription":"This block allows you to enter a SAMBA network share, and then your Raspberry Pi will automatically connect to that network share when it is first switched on. If you want to enter multiple sahred folders, just use this block twice." +} diff --git a/pibakery-blocks/sambamount/sambamount.py b/pibakery-blocks/sambamount/sambamount.py new file mode 100644 index 0000000..386d154 --- /dev/null +++ b/pibakery-blocks/sambamount/sambamount.py @@ -0,0 +1,23 @@ +#!/usr/bin/python + +import sys, os, time + +SMBSERVER = sys.argv[1] +SMBLOCAL = sys.argv[2] +SMBUSERNAME = sys.argv[3] +SMBPASSWORD = sys.argv[4] +SMBDOMMAIN = sys.argv[5] +SMBFILE = sys.argv[6] +SMBDIR = sys.argv[7] + +os.system('sudo -u pi mkdir "' + SMBLOCAL + '"') + +SMBText = SMBSERVER + " " + SMBLOCAL + " cifs username=" + SMBUSERNAME + ",password=" + SMBPASSWORD +if SMBDOMMAIN != "": +SMBText = SMBText + ",domain=" + SMBDOMMAIN + +SMBText = SMBText + ",file_mode=" + SMBFILE + ",dir_mode=" + SMBDIR + ",users,x-systemd.automount,noauto,user_xattr 0 0" +with open("/etc/fstab", "a") as fstabFile: + fstabFile.write(SMBText) + +os.system("mount -a") diff --git a/pibakery-blocks/setaudio/setaudio.json b/pibakery-blocks/setaudio/setaudio.json new file mode 100644 index 0000000..5ab9b51 --- /dev/null +++ b/pibakery-blocks/setaudio/setaudio.json @@ -0,0 +1,21 @@ +{ + "name": "setaudio", + "text": "Audio Mode: %1", + "script": "setaudio.py", + "args": [ + { + "type": "menu", + "options": ["AudioJack","HDMI"] + } + ], + "network": false, + "continue": true, + "type": "setting", + "category":"setting", + "supportedOperatingSystems": [ + "raspbian-pibakery.img", + "raspbian-lite-pibakery.img" + ], + "shortDescription":"Set Audio mode of PI.", + "longDescription":"This block allows you to set the Audio mode of the PI." +} diff --git a/pibakery-blocks/setaudio/setaudio.py b/pibakery-blocks/setaudio/setaudio.py new file mode 100644 index 0000000..d46369c --- /dev/null +++ b/pibakery-blocks/setaudio/setaudio.py @@ -0,0 +1,14 @@ +#!/usr/bin/python + +import sys, os, time + +PIAUDIO = sys.argv[1] + +if PIAUDIO == "AudioJack": + os.system("sed -i 's/#hdmi_drive=2/hdmi_drive=1/' /boot/config.txt") + +if PIAUDIO == "HDMI": + os.system("sed -i 's/#hdmi_drive=2/hdmi_drive=2/' /boot/config.txt") + + + diff --git a/pibakery-blocks/setcameraled/setcameraled.json b/pibakery-blocks/setcameraled/setcameraled.json new file mode 100644 index 0000000..af27c52 --- /dev/null +++ b/pibakery-blocks/setcameraled/setcameraled.json @@ -0,0 +1,21 @@ +{ + "name": "setcameraled", + "text": "%1 Camera led", + "script": "setcameraled.py", + "args": [ + { + "type": "menu", + "options": ["Enable", "Disable"] + } + ], + "network": false, + "continue": true, + "type": "setting", + "category":"setting", + "supportedOperatingSystems": [ + "raspbian-pibakery.img", + "raspbian-lite-pibakery.img" + ], + "shortDescription":"Set Camera led mode of PI.", + "longDescription":"This block allows you to disable the camera led." +} diff --git a/pibakery-blocks/setcameraled/setcameraled.py b/pibakery-blocks/setcameraled/setcameraled.py new file mode 100644 index 0000000..6b2023b --- /dev/null +++ b/pibakery-blocks/setcameraled/setcameraled.py @@ -0,0 +1,15 @@ +#!/usr/bin/python + +import sys, os, time + +PILED = sys.argv[1] + +if PILED == "Enable": + LEDText="disable_camera_led=0" + +if PILED == "Disable": + LEDText="disable_camera_led=1" + +with open("/boot/config.txt", "a") as fstabFile: + fstabFile.write(LEDText) + diff --git a/pibakery-blocks/setdisplay/setdisplay.json b/pibakery-blocks/setdisplay/setdisplay.json new file mode 100644 index 0000000..160c864 --- /dev/null +++ b/pibakery-blocks/setdisplay/setdisplay.json @@ -0,0 +1,21 @@ +{ + "name": "setdisplay", + "text": "Display Mode: %1", + "script": "setdisplay.py", + "args": [ + { + "type": "menu", + "options": ["1024x768","720p","1080p","1440x900","1280x1024","1280x960","1280x800","800x600"] + } + ], + "network": false, + "continue": true, + "type": "setting", + "category":"setting", + "supportedOperatingSystems": [ + "raspbian-pibakery.img", + "raspbian-lite-pibakery.img" + ], + "shortDescription":"Set Display mode of PI.", + "longDescription":"This block allows you to set the display mode of the PI, it also sets the force hotplug so it can be used headless." +} diff --git a/pibakery-blocks/setdisplay/setdisplay.py b/pibakery-blocks/setdisplay/setdisplay.py new file mode 100644 index 0000000..23cc0b4 --- /dev/null +++ b/pibakery-blocks/setdisplay/setdisplay.py @@ -0,0 +1,50 @@ +#!/usr/bin/python + +import sys, os, time + +PIDISPLAY = sys.argv[1] + +if PIDISPLAY == "1024x768": + os.system("sed -i 's/#hdmi_force_hotplug=1/hdmi_force_hotplug=1/' /boot/config.txt") + os.system("sed -i 's/#hdmi_group=1/hdmi_group=2/' /boot/config.txt") + os.system("sed -i 's/#hdmi_mode=1/hdmi_mode=16/' /boot/config.txt") + +if PIDISPLAY == "720p": + os.system("sed -i 's/#hdmi_force_hotplug=1/hdmi_force_hotplug=1/' /boot/config.txt") + os.system("sed -i 's/#hdmi_group=1/hdmi_group=1/' /boot/config.txt") + os.system("sed -i 's/#hdmi_mode=1/hdmi_mode=4/' /boot/config.txt") + +if PIDISPLAY == "1080p": + os.system("sed -i 's/#hdmi_force_hotplug=1/hdmi_force_hotplug=1/' /boot/config.txt") + os.system("sed -i 's/#hdmi_group=1/hdmi_group=1/' /boot/config.txt") + os.system("sed -i 's/#hdmi_mode=1/hdmi_mode=16/' /boot/config.txt") + +if PIDISPLAY == "1440x900": + os.system("sed -i 's/#hdmi_force_hotplug=1/hdmi_force_hotplug=1/' /boot/config.txt") + os.system("sed -i 's/#hdmi_group=1/hdmi_group=2/' /boot/config.txt") + os.system("sed -i 's/#hdmi_mode=1/hdmi_mode=47/' /boot/config.txt") + +if PIDISPLAY == "1280x1024": + os.system("sed -i 's/#hdmi_force_hotplug=1/hdmi_force_hotplug=1/' /boot/config.txt") + os.system("sed -i 's/#hdmi_group=1/hdmi_group=2/' /boot/config.txt") + os.system("sed -i 's/#hdmi_mode=1/hdmi_mode=35/' /boot/config.txt") + +if PIDISPLAY == "1280x960": + os.system("sed -i 's/#hdmi_force_hotplug=1/hdmi_force_hotplug=1/' /boot/config.txt") + os.system("sed -i 's/#hdmi_group=1/hdmi_group=2/' /boot/config.txt") + os.system("sed -i 's/#hdmi_mode=1/hdmi_mode=32/' /boot/config.txt") + +if PIDISPLAY == "1280x800": + os.system("sed -i 's/#hdmi_force_hotplug=1/hdmi_force_hotplug=1/' /boot/config.txt") + os.system("sed -i 's/#hdmi_group=1/hdmi_group=2/' /boot/config.txt") + os.system("sed -i 's/#hdmi_mode=1/hdmi_mode=28/' /boot/config.txt") + +if PIDISPLAY == "800x600": + os.system("sed -i 's/#hdmi_force_hotplug=1/hdmi_force_hotplug=1/' /boot/config.txt") + os.system("sed -i 's/#hdmi_group=1/hdmi_group=2/' /boot/config.txt") + os.system("sed -i 's/#hdmi_mode=1/hdmi_mode=9/' /boot/config.txt") + + + + + diff --git a/pibakery-blocks/unifiinstall/unifiinstall.json b/pibakery-blocks/unifiinstall/unifiinstall.json new file mode 100644 index 0000000..7584bb7 --- /dev/null +++ b/pibakery-blocks/unifiinstall/unifiinstall.json @@ -0,0 +1,16 @@ +{ + "name": "unifiinstall", + "text": "Install Unifi Managment\\nRequires internet connection", + "script": "unifiinstall.sh", + "args": [], + "network": true, + "continue": true, + "type": "software", + "category":"software", + "supportedOperatingSystems": [ + "raspbian-pibakery.img", + "raspbian-lite-pibakery.img" + ], + "shortDescription":"Installs the Unifi Managment Software. Internet connection required.", + "longDescription":"This block allows you to install Unifi Managment Software. An internet connection will be required for this to work." +} diff --git a/pibakery-blocks/unifiinstall/unifiinstall.sh b/pibakery-blocks/unifiinstall/unifiinstall.sh new file mode 100644 index 0000000..17052b3 --- /dev/null +++ b/pibakery-blocks/unifiinstall/unifiinstall.sh @@ -0,0 +1,10 @@ +#!/bin/bash +echo 'deb http://www.ubnt.com/downloads/unifi/debian unifi5 ubiquiti' | sudo tee -a /etc/apt/sources.list.d/ubnt.list > /dev/null +apt-key adv --keyserver keyserver.ubuntu.com --recv C0A52C50 +apt-get update +apt-get install unifi oracle-java8-jdk -y +echo 'ENABLE_MONGODB=no' | sudo tee -a /etc/mongodb.conf > /dev/null +cp /lib/systemd/system/unifi.service /etc/systemd/system/ +sed -i '/^\[Service\]$/a Environment=JAVA_HOME=/usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt' /etc/systemd/system/unifi.service +#apt-get update && sudo apt-get upgrade -y +#apt-get install rpi-update && echo Y | sudo rpi-update \ No newline at end of file