Files
operating-system/buildroot-external/rootfs-overlay/usr/sbin/hassos-config
Pascal Vizeli 27cd425f5b Use systemd for config mount (#37)
* Create mnt-config.mount

* Update hassos-config

* Update mnt-config.mount

* Update hassos-config
2018-06-26 10:18:16 +02:00

55 lines
1.2 KiB
Bash
Executable File

#!/bin/sh
# Mount config folder
systemctl start mnt-config.mount
if ! systemctl -q is-active mnt-config.mount; then
echo "[Warning] No config partition found"
exit 0
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/known_hosts ]; then
echo "[Info] Update SSH known_hosts!"
cp -f /mnt/config/known_hosts /root/.ssh/known_hosts
chmod 600 /root/.ssh/known_hosts
systemctl start dropbear
else
rm -f /root/.ssh/known_hosts
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)
rauc install /mnt/config/$rauc_filename
fi
# Cleanup config partition
systemctl stop mnt-config.mount