2024-02-29 09:53:34 -05:00
|
|
|
#!/bin/sh
|
|
|
|
# Script to unlock the /storage partition and start up services that depend on it.
|
|
|
|
|
|
|
|
# check if the current user is root
|
|
|
|
if [ "$(id -u)" != "0" ]; then
|
|
|
|
echo "This script must be run as root" 1>&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2024-05-16 20:08:57 -04:00
|
|
|
# Unlock and mount storage directory if we haven't already
|
2024-05-19 14:33:15 -04:00
|
|
|
if [ -e "/dev/mapper/storage" ]; then
|
|
|
|
echo "Storage partition already mounted."
|
|
|
|
else
|
|
|
|
echo "Unlocking storage partition..."
|
2024-05-16 20:08:57 -04:00
|
|
|
cryptsetup luksOpen /dev/md/Sapana storage
|
|
|
|
mount /dev/mapper/storage /storage
|
|
|
|
echo "Storage partition mounted."
|
|
|
|
fi
|
2024-05-15 14:10:46 -04:00
|
|
|
|
2024-05-19 14:33:15 -04:00
|
|
|
echo "Starting services..."
|
2024-08-22 16:26:30 -04:00
|
|
|
systemctl restart duplicacy-web.service forgejo.service jellyfin.service
|
2024-05-16 20:08:57 -04:00
|
|
|
systemctl --machine aires@.host --user start syncthing.service
|
2024-05-19 14:33:15 -04:00
|
|
|
systemctl restart nginx.service
|
2024-07-19 11:27:38 -04:00
|
|
|
echo "Services started. $(hostname) is ready to go!"
|
2024-02-29 09:53:34 -05:00
|
|
|
|
2024-05-15 14:10:46 -04:00
|
|
|
exit 0
|