* Use CONFIG as label for config partition * Update configuration.md * Update hassos-config
65 lines
1.4 KiB
Bash
Executable File
65 lines
1.4 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
if ! findfs LABEL="config" > /dev/null; then
|
|
echo "[Warning] No config partition found"
|
|
exit 0
|
|
fi
|
|
|
|
# Mount config folder
|
|
systemctl start mnt-config.mount
|
|
if ! systemctl -q is-active mnt-config.mount; then
|
|
echo "[Error] Can't mount config partition"
|
|
exit 1
|
|
fi
|
|
|
|
##
|
|
# NetworkManager
|
|
if [ -d /mnt/config/network ]; then
|
|
echo "[Info] Update NetworkManager connections!"
|
|
|
|
rm -rf /etc/NetworkManager/system-connections/*
|
|
cp -f /mnt/config/network/* /etc/NetworkManager/system-connections/
|
|
|
|
nmcli con reload
|
|
fi
|
|
|
|
##
|
|
# Modules
|
|
if [ -d /mnt/config/modules ]; then
|
|
echo "[Info] Update Modules configuration!"
|
|
|
|
rm -rf /etc/modules-load.d/*
|
|
cp -f /mnt/config/modules/* /etc/modules-load.d/*
|
|
fi
|
|
|
|
##
|
|
# SSH know hosts
|
|
if [ -f /mnt/config/authorized_keys ]; then
|
|
echo "[Info] Update SSH authorized_keys!"
|
|
|
|
cp -f /mnt/config/authorized_keys /root/.ssh/authorized_keys
|
|
chmod 600 /root/.ssh/authorized_keys
|
|
|
|
systemctl start dropbear
|
|
else
|
|
rm -f /root/.ssh/authorized_keys
|
|
systemctl stop dropbear
|
|
fi
|
|
|
|
##
|
|
# Firmware update
|
|
if ls /mnt/config/*.raucb > /dev/null; then
|
|
echo "[Info] Performe a firmware update"
|
|
|
|
rauc_filename=$(ls /mnt/config/*.raucb | head -n 1)
|
|
if rauc install ${rauc_filename}; then
|
|
echo "[Info] Firmware update success"
|
|
systemctl reboot
|
|
else
|
|
echo "[Error] Firmware update fails"
|
|
fi
|
|
fi
|
|
|
|
# Cleanup config partition
|
|
systemctl stop mnt-config.mount
|