diff --git a/stage2/01-sys-tweaks/01-run.sh b/stage2/01-sys-tweaks/01-run.sh index 7a286bc..f35926b 100755 --- a/stage2/01-sys-tweaks/01-run.sh +++ b/stage2/01-sys-tweaks/01-run.sh @@ -193,30 +193,31 @@ sudo update-rc.d isc-dhcp-server enable -sudo wget https://dride.io/code/startup/dride-ws -sudo wget https://dride.io/code/startup/dride-core -sudo wget https://dride.io/code/startup/drideOS-resize - #startup script's # express on startup -sudo cp dride-ws /etc/init.d/dride-ws +sudo cp files/dride-ws /etc/init.d/dride-ws sudo chmod +x /etc/init.d/dride-ws sudo update-rc.d dride-ws defaults -sudo rm dride-ws + # dride-core on startup -sudo cp dride-core /etc/init.d/dride-core +if [ ${OS_TYPE} == "drideOS" ]; then + sudo cp files/dride-core /etc/init.d/dride-core +else + sudo cp files/dride-core-z /etc/init.d/dride-core +fi; + sudo chmod +x /etc/init.d/dride-core sudo update-rc.d dride-core defaults -sudo rm dride-core + if [ ${OS_TYPE} == "drideOS" ]; then # drideOS-resize on startup - sudo cp drideOS-resize /etc/init.d/drideOS-resize + sudo cp files/drideOS-resize /etc/init.d/drideOS-resize sudo chmod +x /etc/init.d/drideOS-resize sudo update-rc.d drideOS-resize defaults - sudo rm drideOS-resize + fi diff --git a/stage2/01-sys-tweaks/files/startup/dride-core b/stage2/01-sys-tweaks/files/startup/dride-core new file mode 100755 index 0000000..6d26154 --- /dev/null +++ b/stage2/01-sys-tweaks/files/startup/dride-core @@ -0,0 +1,42 @@ +#! /bin/sh +# /etc/init.d/dride-core + +### BEGIN INIT INFO +# Provides: dride-core +# Required-Start: $remote_fs $syslog +# Required-Stop: $remote_fs $syslog +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: will run the main dride-core process +# Description: +### END INIT INFO + + +case "$1" in + start) + echo "Starting dride-core" + # run application you want to start + sudo python /home/Cardigan/mainPi.py & + + # run gps daemon + sudo python /home/Cardigan/daemons/gps/helper.py & + + # run button / bluetooth daemon + sudo python /home/Cardigan/daemons/bluetooth/initPin.py & + sleep 5 && sudo BLENO_DEVICE_NAME="dride" node /home/Cardigan/daemons/bluetooth/main.js & + ;; + stop) + echo "Stopping dride-core" + # kill application you want to stop + killall python + ;; + *) + echo "Usage: /etc/init.d/dride-core{start|stop}" + exit 1 + ;; +esac + +exit 0 + + + diff --git a/stage2/01-sys-tweaks/files/startup/dride-core-z b/stage2/01-sys-tweaks/files/startup/dride-core-z new file mode 100755 index 0000000..6997616 --- /dev/null +++ b/stage2/01-sys-tweaks/files/startup/dride-core-z @@ -0,0 +1,42 @@ +#! /bin/sh +# /etc/init.d/dride-core + +### BEGIN INIT INFO +# Provides: dride-core +# Required-Start: $remote_fs $syslog +# Required-Stop: $remote_fs $syslog +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: will run the main dride-core process +# Description: +### END INIT INFO + + +case "$1" in + start) + echo "Starting dride-core" + # run application you want to start + sudo python /home/Cardigan/mainPiZero.py & + + # run gps daemon + sudo python /home/Cardigan/daemons/gps/helper.py & + + # run button / bluetooth daemon + sudo python /home/Cardigan/daemons/bluetooth/initPin.py & + sleep 5 && sudo BLENO_DEVICE_NAME="dride" node /home/Cardigan/daemons/bluetooth/main.js & + ;; + stop) + echo "Stopping dride-core" + # kill application you want to stop + killall python + ;; + *) + echo "Usage: /etc/init.d/dride-core{start|stop}" + exit 1 + ;; +esac + +exit 0 + + + diff --git a/stage2/01-sys-tweaks/files/startup/dride-ws b/stage2/01-sys-tweaks/files/startup/dride-ws new file mode 100755 index 0000000..18f26e4 --- /dev/null +++ b/stage2/01-sys-tweaks/files/startup/dride-ws @@ -0,0 +1,31 @@ +#! /bin/sh +# /etc/init.d/dride-ws + +### BEGIN INIT INFO +# Provides: dride-ws +# Required-Start: $remote_fs $syslog +# Required-Stop: $remote_fs $syslog +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: will run the dride web server on startup +# Description: AKA dride-ws +### END INIT INFO + +case "$1" in + start) + echo "Starting dride-ws" + # run node-express server + sudo node /home/Cardigan/dride-ws/server/app.js & + ;; + stop) + echo "Stopping dride-ws" + # kill application you want to stop + killall node + ;; + *) + echo "Usage: /etc/init.d/dride-ws{start|stop}" + exit 1 + ;; +esac + +exit 0 \ No newline at end of file diff --git a/stage2/01-sys-tweaks/files/startup/drideOS-resize b/stage2/01-sys-tweaks/files/startup/drideOS-resize new file mode 100755 index 0000000..5fa228b --- /dev/null +++ b/stage2/01-sys-tweaks/files/startup/drideOS-resize @@ -0,0 +1,18 @@ +#! /bin/sh + +### BEGIN INIT INFO +# Provides: drideOS-resize +# Required-Start: $remote_fs $syslog +# Required-Stop: $remote_fs $syslog +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: will resize the file system & reboot +# Description: +### END INIT INFO + +echo "dwc_otg.lpm_enable=0 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait" > /boot/cmdline.txt + +# Delete the script +rm $0 +# reboot +sudo reboot \ No newline at end of file