Use systemd for config mount (#37)

* Create mnt-config.mount

* Update hassos-config

* Update mnt-config.mount

* Update hassos-config
This commit is contained in:
Pascal Vizeli 2018-06-26 10:18:16 +02:00 committed by GitHub
parent 42f1c4bf01
commit 27cd425f5b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 9 deletions

View File

@ -0,0 +1,8 @@
[Unit]
Description=HassOS config partition
[Mount]
What=LABEL=hassos-config
Where=/mnt/config
Type=auto
Options=ro

View File

@ -1,15 +1,12 @@
#!/bin/sh
set -e
# Check if hassos-config is present
if ! findfs LABEL="hassos-config" > /dev/null; then
echo "[Warning] No hassos-config partition found!"
# 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
# Mount config partition
mount -o ro LABEL="hassos-config" /mnt/config
##
# NetworkManager
if [ -d /mnt/config/network ]; then
@ -18,7 +15,7 @@ if [ -d /mnt/config/network ]; then
rm -rf /etc/NetworkManager/system-connections/*
cp -f /mnt/config/network/* /etc/NetworkManager/system-connections/
nmcli con reload || true
nmcli con reload
fi
##
@ -54,4 +51,4 @@ if ls /mnt/config/*.raucb > /dev/null; then
fi
# Cleanup config partition
umount /mnt/config
systemctl stop mnt-config.mount