Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
dc75354
ip changer
eddwatts Nov 1, 2016
6279925
ip change script
eddwatts Nov 1, 2016
35c15f5
create folder
eddwatts Nov 1, 2016
df962e8
create folder script
eddwatts Nov 1, 2016
6d763e5
added as user
eddwatts Nov 1, 2016
3be3c34
added as user
eddwatts Nov 1, 2016
8e8e14e
update to make as user
eddwatts Nov 1, 2016
5c1e156
error for lan (eth0) corrected
eddwatts Nov 2, 2016
31776e6
folder for user pi command updated
eddwatts Nov 2, 2016
d38101c
Create sambamount.json
eddwatts Nov 2, 2016
053c33d
SAMBA mount script
eddwatts Nov 2, 2016
472a42b
Set the display mode of the pi
eddwatts Nov 2, 2016
57c73e7
set display mode script
eddwatts Nov 2, 2016
58121b6
correct if statements, silly mistake
eddwatts Nov 2, 2016
a03d01f
correct problem with if statment
eddwatts Nov 2, 2016
66f1316
corrected error with folder and cifs (missing space)
eddwatts Nov 2, 2016
2861845
change to how mount works to enable automatic mount on reboot
eddwatts Nov 2, 2016
40a1973
Update sambamount.py
eddwatts Nov 2, 2016
45ea8e2
Set Audio Mode
eddwatts Nov 2, 2016
eec716c
Set Audio mode script
eddwatts Nov 2, 2016
38fc8c2
Set Camera Led
eddwatts Nov 2, 2016
72e34f7
camera led script
eddwatts Nov 2, 2016
b850c44
Update setaudio.json
eddwatts Nov 2, 2016
935ad72
Update setdisplay.json
eddwatts Nov 2, 2016
0cd6715
install a unifi server
eddwatts Nov 2, 2016
92e1ff1
unifi install script
eddwatts Nov 2, 2016
9a58613
waveshare LCD install script
eddwatts Nov 16, 2016
8a5439c
waveshare LCD install Block
eddwatts Nov 16, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions pibakery-blocks/createfolder/createfolder.json
Original file line number Diff line number Diff line change
@@ -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."
}
6 changes: 6 additions & 0 deletions pibakery-blocks/createfolder/createfolder.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash
if [ $2 == "root" ]; then
su - root -c 'mkdir "$1"'
else
sudo -u pi mkdir "$1"
fi
36 changes: 36 additions & 0 deletions pibakery-blocks/ipchange/ipchange.json
Original file line number Diff line number Diff line change
@@ -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."
}
57 changes: 57 additions & 0 deletions pibakery-blocks/ipchange/ipchange.py
Original file line number Diff line number Diff line change
@@ -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")

25 changes: 25 additions & 0 deletions pibakery-blocks/lcd-show/lcd-show.json
Original file line number Diff line number Diff line change
@@ -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"
}
34 changes: 34 additions & 0 deletions pibakery-blocks/lcd-show/lcd-show.py
Original file line number Diff line number Diff line change
@@ -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")
50 changes: 50 additions & 0 deletions pibakery-blocks/sambamount/sambamount.json
Original file line number Diff line number Diff line change
@@ -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."
}
23 changes: 23 additions & 0 deletions pibakery-blocks/sambamount/sambamount.py
Original file line number Diff line number Diff line change
@@ -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")
21 changes: 21 additions & 0 deletions pibakery-blocks/setaudio/setaudio.json
Original file line number Diff line number Diff line change
@@ -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."
}
14 changes: 14 additions & 0 deletions pibakery-blocks/setaudio/setaudio.py
Original file line number Diff line number Diff line change
@@ -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")



21 changes: 21 additions & 0 deletions pibakery-blocks/setcameraled/setcameraled.json
Original file line number Diff line number Diff line change
@@ -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."
}
15 changes: 15 additions & 0 deletions pibakery-blocks/setcameraled/setcameraled.py
Original file line number Diff line number Diff line change
@@ -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)

21 changes: 21 additions & 0 deletions pibakery-blocks/setdisplay/setdisplay.json
Original file line number Diff line number Diff line change
@@ -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."
}
Loading