Update config implement noreboot option

beta-pl
Alan Johnston 2 years ago committed by GitHub
parent e3e9aa85c3
commit e5ea0a0664
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

165
config

@ -9,6 +9,9 @@ else
norestart=0 norestart=0
fi fi
reboot=0
restart=0
if [ "$1" = "" ]; then if [ "$1" = "" ]; then
value=`cat /home/pi/CubeSatSim/.mode` value=`cat /home/pi/CubeSatSim/.mode`
echo "$value" > /dev/null echo "$value" > /dev/null
@ -97,10 +100,11 @@ if [ "$1" = "" ]; then
elif [ "$1" = "-i" ]; then elif [ "$1" = "-i" ]; then
echo "Rebooting CubeSatSim" reboot=1
sudo reboot now ## echo "Rebooting CubeSatSim"
## sudo reboot now
# sudo systemctl restart cubesatsim # sudo systemctl restart cubesatsim
exit ## exit
elif [ "$1" = "-a" ]; then elif [ "$1" = "-a" ]; then
echo "changing CubeSatSim to AFSK mode" echo "changing CubeSatSim to AFSK mode"
sudo echo "a" > /home/pi/CubeSatSim/.mode sudo echo "a" > /home/pi/CubeSatSim/.mode
@ -114,11 +118,12 @@ elif [ "$1" = "-a" ]; then
# sudo sed -i ':a;N;$!ba;s/\nforce_turbo=1//g' /boot/config.txt # sudo sed -i ':a;N;$!ba;s/\nforce_turbo=1//g' /boot/config.txt
fi fi
echo "rebooting" reboot=1
sudo systemctl stop rpitx ## echo "rebooting"
sudo reboot now ## sudo systemctl stop rpitx
## sudo reboot now
# sudo systemctl restart cubesatsim # sudo systemctl restart cubesatsim
exit ## exit
elif [ "$1" = "-m" ]; then elif [ "$1" = "-m" ]; then
echo "changing CubeSatSim to CW mode" echo "changing CubeSatSim to CW mode"
@ -132,29 +137,32 @@ elif [ "$1" = "-m" ]; then
echo "Battery saver mode is OFF." echo "Battery saver mode is OFF."
# sudo sed -i ':a;N;$!ba;s/\nforce_turbo=1//g' /boot/config.txt # sudo sed -i ':a;N;$!ba;s/\nforce_turbo=1//g' /boot/config.txt
fi fi
echo "rebooting" reboot=1
sudo systemctl stop rpitx ## echo "rebooting"
sudo reboot now ## sudo systemctl stop rpitx
## sudo reboot now
# sudo systemctl restart cubesatsim # sudo systemctl restart cubesatsim
exit ## exit
elif [ "$1" = "-f" ]; then elif [ "$1" = "-f" ]; then
echo "changing CubeSatSim to FSK mode" echo "changing CubeSatSim to FSK mode"
sudo echo "f" > /home/pi/CubeSatSim/.mode sudo echo "f" > /home/pi/CubeSatSim/.mode
# if ! grep -q force_turbo=1 /boot/config.txt ; then sudo sh -c 'echo "force_turbo=1" >> /boot/config.txt'; fi # if ! grep -q force_turbo=1 /boot/config.txt ; then sudo sh -c 'echo "force_turbo=1" >> /boot/config.txt'; fi
echo "rebooting" reboot=1
sudo systemctl stop rpitx ## echo "rebooting"
sudo reboot now ## sudo systemctl stop rpitx
## sudo reboot now
# sudo systemctl restart cubesatsim # sudo systemctl restart cubesatsim
exit ## exit
elif [ "$1" = "-b" ]; then elif [ "$1" = "-b" ]; then
echo "changing CubeSatSim to BPSK mode" echo "changing CubeSatSim to BPSK mode"
sudo echo "b" > /home/pi/CubeSatSim/.mode sudo echo "b" > /home/pi/CubeSatSim/.mode
# if ! grep -q force_turbo=1 /boot/config.txt ; then sudo sh -c 'echo "force_turbo=1" >> /boot/config.txt'; fi # if ! grep -q force_turbo=1 /boot/config.txt ; then sudo sh -c 'echo "force_turbo=1" >> /boot/config.txt'; fi
echo "rebooting" reboot=1
sudo systemctl stop rpitx ## echo "rebooting"
sudo reboot now ## sudo systemctl stop rpitx
## sudo reboot now
# sudo systemctl restart cubesatsim # sudo systemctl restart cubesatsim
exit ## exit
elif [ "$1" = "-s" ]; then elif [ "$1" = "-s" ]; then
echo "changing CubeSatSim to SSTV mode" echo "changing CubeSatSim to SSTV mode"
sudo echo "s" > /home/pi/CubeSatSim/.mode sudo echo "s" > /home/pi/CubeSatSim/.mode
@ -167,11 +175,12 @@ elif [ "$1" = "-s" ]; then
echo "Battery saver mode is OFF." echo "Battery saver mode is OFF."
# sudo sed -i ':a;N;$!ba;s/\nforce_turbo=1//g' /boot/config.txt # sudo sed -i ':a;N;$!ba;s/\nforce_turbo=1//g' /boot/config.txt
fi fi
echo "rebooting" reboot=1
sudo systemctl stop rpitx ## echo "rebooting"
sudo reboot now ## sudo systemctl stop rpitx
## sudo reboot now
# sudo systemctl restart cubesatsim # sudo systemctl restart cubesatsim
exit ## exit
elif [ "$1" = "-t" ]; then elif [ "$1" = "-t" ]; then
@ -212,10 +221,11 @@ elif [ "$1" = "-t" ]; then
echo $1 $2 $3 $4 $sim $6 $7 $8 $9 $10 $11 echo $1 $2 $3 $4 $sim $6 $7 $8 $9 $10 $11
echo $1 $2 $3 $4 $sim $6 $7 $8 $9 $10 $11 > /home/pi/CubeSatSim/sim.cfg echo $1 $2 $3 $4 $sim $6 $7 $8 $9 $10 $11 > /home/pi/CubeSatSim/sim.cfg
echo echo
echo "Rebooting CubeSatSim with new configuration file" ## echo "Rebooting CubeSatSim with new configuration file"
echo ## echo
sudo reboot now reboot=1
## sudo reboot now
# sudo systemctl restart cubesatsim # sudo systemctl restart cubesatsim
elif [ "$1" = "-c" ]; then elif [ "$1" = "-c" ]; then
@ -258,9 +268,10 @@ elif [ "$1" = "-c" ]; then
echo echo
else else
echo echo
echo "Rebooting CubeSatSim with new configuration file" ## echo "Rebooting CubeSatSim with new configuration file"
echo ## echo
sudo reboot now reboot=1
## sudo reboot now
# sudo systemctl restart cubesatsim # sudo systemctl restart cubesatsim
fi fi
@ -310,10 +321,11 @@ elif [ "$1" = "-r" ]; then
if [ "$norestart" = "1" ]; then if [ "$norestart" = "1" ]; then
echo echo
else else
echo ## echo
echo "Rebooting CubeSatSim with new configuration file" ## echo "Rebooting CubeSatSim with new configuration file"
echo ## echo
sudo reboot now reboot=1
## sudo reboot now
# sudo systemctl restart cubesatsim # sudo systemctl restart cubesatsim
fi fi
@ -385,10 +397,11 @@ elif [ "$1" = "-l" ]; then
if [ "$norestart" = "1" ]; then if [ "$norestart" = "1" ]; then
echo echo
else else
echo ## echo
echo "Rebooting CubeSatSim with new configuration file" ## echo "Rebooting CubeSatSim with new configuration file"
echo ## echo
sudo reboot now reboot=1
## sudo reboot now
# sudo systemctl restart cubesatsim # sudo systemctl restart cubesatsim
fi fi
@ -421,9 +434,10 @@ elif [ "$1" = "-C" ]; then
sudo journalctl --rotate sudo journalctl --rotate
sudo journalctl --vacuum-time=1s sudo journalctl --vacuum-time=1s
sudo systemctl reboot now reboot=1
## sudo systemctl reboot now
echo "rebooting" ## echo "rebooting"
elif [ "$1" = "-T" ]; then elif [ "$1" = "-T" ]; then
@ -442,9 +456,10 @@ elif [ "$1" = "-T" ]; then
if [ "$reset" = "y" ] || [ "$reset" = "yes" ] ; then if [ "$reset" = "y" ] || [ "$reset" = "yes" ] ; then
echo "Command and control set to OFF" echo "Command and control set to OFF"
sudo rm /home/pi/CubeSatSim/command_control sudo rm /home/pi/CubeSatSim/command_control
echo "rebooting" reboot=1
sudo systemctl stop rpitx ## echo "rebooting"
sudo reboot now ## sudo systemctl stop rpitx
## sudo reboot now
fi fi
else else
@ -457,9 +472,10 @@ elif [ "$1" = "-T" ]; then
if [ "$reset" = "y" ] || [ "$reset" = "yes" ] ; then if [ "$reset" = "y" ] || [ "$reset" = "yes" ] ; then
echo "Command and control set to ON" echo "Command and control set to ON"
sudo touch /home/pi/CubeSatSim/command_control sudo touch /home/pi/CubeSatSim/command_control
echo "rebooting" ## echo "rebooting"
sudo systemctl stop rpitx reboot=1
sudo reboot now ## sudo systemctl stop rpitx
## sudo reboot now
fi fi
fi fi
@ -508,7 +524,7 @@ elif [ "$1" = "-B" ]; then
read saver read saver
echo echo
reboot=0 ## reboot=0
if [ "$saver" = "y" ] || [ "$saver" = "yes" ] ; then if [ "$saver" = "y" ] || [ "$saver" = "yes" ] ; then
if [ "$mode" = "0" ] ; then if [ "$mode" = "0" ] ; then
@ -531,11 +547,13 @@ elif [ "$1" = "-B" ]; then
set -- $value set -- $value
if [ "$1" = "a" ] || [ "$1" = "s" ] || [ "$1" = "m" ] ; then if [ "$1" = "a" ] || [ "$1" = "s" ] || [ "$1" = "m" ] ; then
echo "rebooting" reboot=1
sudo reboot now ## echo "rebooting"
## sudo reboot now
else else
echo "restarting" restart=1
sudo systemctl restart cubesatsim ## echo "restarting"
## sudo systemctl restart cubesatsim
fi fi
fi fi
@ -580,10 +598,11 @@ elif [ "$1" = "-q" ]; then
echo $1 $2 $3 $4 $5 $sq $7 $8 $9 $10 $11 echo $1 $2 $3 $4 $5 $sq $7 $8 $9 $10 $11
echo $1 $2 $3 $4 $4 $sq $7 $8 $9 $10 $11 > /home/pi/CubeSatSim/sim.cfg echo $1 $2 $3 $4 $4 $sq $7 $8 $9 $10 $11 > /home/pi/CubeSatSim/sim.cfg
echo echo
echo "Rebooting CubeSatSim with new configuration file" ## echo "Rebooting CubeSatSim with new configuration file"
echo ## echo
sudo reboot now reboot=1
## sudo reboot now
# sudo systemctl restart cubesatsim # sudo systemctl restart cubesatsim
@ -647,10 +666,11 @@ elif [ "$1" = "-P" ]; then
echo $1 $2 $3 $4 $5 $6 $7 $8 $9 $rxpl $txpl echo $1 $2 $3 $4 $5 $6 $7 $8 $9 $rxpl $txpl
echo $1 $2 $3 $4 $5 $6 $7 $8 $9 $rxpl $txpl > /home/pi/CubeSatSim/sim.cfg echo $1 $2 $3 $4 $5 $6 $7 $8 $9 $rxpl $txpl > /home/pi/CubeSatSim/sim.cfg
echo echo
echo "Rebooting CubeSatSim with new configuration file" ## echo "Rebooting CubeSatSim with new configuration file"
echo ## echo
sudo reboot now reboot=1
## sudo reboot now
# sudo systemctl restart cubesatsim # sudo systemctl restart cubesatsim
elif [ "$1" = "-F" ]; then elif [ "$1" = "-F" ]; then
@ -705,9 +725,10 @@ elif [ "$1" = "-F" ]; then
# echo # echo
# else # else
echo echo
echo "Rebooting CubeSatSim with new configuration file" ## echo "Rebooting CubeSatSim with new configuration file"
echo ## echo
sudo reboot now reboot=1
## sudo reboot now
# sudo systemctl restart cubesatsim # sudo systemctl restart cubesatsim
# fi # fi
elif [ "$1" = "-H" ]; then elif [ "$1" = "-H" ]; then
@ -749,10 +770,11 @@ elif [ "$1" = "-H" ]; then
echo $1 $2 $3 $4 $5 $6 $7 $8 $hab $10 $11 echo $1 $2 $3 $4 $5 $6 $7 $8 $hab $10 $11
echo $1 $2 $3 $4 $5 $6 $7 $8 $hab $10 $11 > /home/pi/CubeSatSim/sim.cfg echo $1 $2 $3 $4 $5 $6 $7 $8 $hab $10 $11 > /home/pi/CubeSatSim/sim.cfg
echo echo
echo "Rebooting CubeSatSim with new configuration file" ## echo "Rebooting CubeSatSim with new configuration file"
echo ## echo
sudo reboot now reboot=1
## sudo reboot now
# sudo systemctl restart cubesatsim # sudo systemctl restart cubesatsim
elif [ "$1" = "-p" ]; then elif [ "$1" = "-p" ]; then
@ -808,3 +830,22 @@ else
fi fi
# sudo systemctl restart cubesatsim # sudo systemctl restart cubesatsim
echo "Checking for reboot or restart"
if [ "$noreboot" = "0" ] ; then
if [ "$reboot" = "1" ] ; then
echo "Rebooting"
fi
if [ "$restart" = "1" ] ; then
echo "Restarting"
fi
else
echo "Reboot disabled"
fi

Loading…
Cancel
Save

Powered by TurnKey Linux.