added hostname backup and restore
https://github.com/evilsocket/pwnagotchi/issues/69#issue-501710314 Couldn't decide if it should be a separate option by itself, but I personally think they do go hand in hand.
This commit is contained in:
parent
bbcfae19a7
commit
f108ed95a7
@ -18,8 +18,8 @@ function usage() {
|
|||||||
-v # Version to update to, can be a branch or commit. (default: master)
|
-v # Version to update to, can be a branch or commit. (default: master)
|
||||||
-u # Url to clone from. (default: https://github.com/evilsocket/pwnagotchi)
|
-u # Url to clone from. (default: https://github.com/evilsocket/pwnagotchi)
|
||||||
-m # Mode to restart to. (Supported: ${SUPPORTED_RESTART_MODES[*]}; default: auto)
|
-m # Mode to restart to. (Supported: ${SUPPORTED_RESTART_MODES[*]}; default: auto)
|
||||||
-b # Backup the current pwnagotchi config.
|
-b # Backup the current pwnagotchi config and hostname references.
|
||||||
-r # Restore the current pwnagotchi config. (-b will be enabled.)
|
-r # Restore the current pwnagotchi config and hostname references. (-b will be enabled.)
|
||||||
-h # Shows this help.
|
-h # Shows this help.
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
@ -89,8 +89,11 @@ echo "[+] Installing $(git log -1 --format="%h")"
|
|||||||
|
|
||||||
echo "[+] Updating..."
|
echo "[+] Updating..."
|
||||||
if [ $BACKUPCONFIG -eq 1 ]; then
|
if [ $BACKUPCONFIG -eq 1 ]; then
|
||||||
echo "[+] Creating backup of config.yml"
|
echo "[+] Creating backup of config.yml and hostname references"
|
||||||
mv /root/pwnagotchi/config.yml /root/config.yml.bak -f
|
mv /root/pwnagotchi/config.yml /root/config.bak -f
|
||||||
|
mv /etc/hosts /root/hosts.bak -f
|
||||||
|
mv /etc/hostname /root/hostname.bak -f
|
||||||
|
mv /etc/network/interfaces /root/interfaces.bak -f
|
||||||
fi
|
fi
|
||||||
rm /root/pwnagotchi -rf # ensures old files are removed
|
rm /root/pwnagotchi -rf # ensures old files are removed
|
||||||
rsync -aPq $GIT_FOLDER/sdcard/boot/* /boot/
|
rsync -aPq $GIT_FOLDER/sdcard/boot/* /boot/
|
||||||
@ -98,8 +101,11 @@ rsync -aPq $GIT_FOLDER/sdcard/rootfs/* /
|
|||||||
cd /tmp
|
cd /tmp
|
||||||
rm $GIT_FOLDER -rf
|
rm $GIT_FOLDER -rf
|
||||||
if [ $RESTORECONFIG -eq 1 ]; then
|
if [ $RESTORECONFIG -eq 1 ]; then
|
||||||
echo "[+] Restoring backup of config.yml"
|
echo "[+] Restoring backup of config.yml and hostname references"
|
||||||
mv /root/config.yml.bak /root/pwnagotchi/config.yml -f
|
mv /root/config.yml.bak /root/pwnagotchi/config.yml -f
|
||||||
|
mv /etc/hosts.bak /etc/hosts -f
|
||||||
|
mv /etc/hostname.bak /etc/hostname -f
|
||||||
|
mv /etc/network/interfaces.bak /etc/network/interfaces -f
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "[+] Restarting pwnagotchi in $MODE mode. $( screen -X -S pwnagotchi quit)"
|
echo "[+] Restarting pwnagotchi in $MODE mode. $( screen -X -S pwnagotchi quit)"
|
||||||
@ -108,4 +114,4 @@ if [ $MODE == "auto" ]; then
|
|||||||
elif [ $MODE == "manual" ]; then
|
elif [ $MODE == "manual" ]; then
|
||||||
sudo -H -u root /usr/bin/screen -dmS pwnagotchi -c /root/pwnagotchi/data/screenrc.manual
|
sudo -H -u root /usr/bin/screen -dmS pwnagotchi -c /root/pwnagotchi/data/screenrc.manual
|
||||||
fi
|
fi
|
||||||
echo "[+] Finished"
|
echo "[+] Finished"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user