2024-02-29 14:53:34 +00: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
|
|
|
|
|
|
|
|
# Immediately exit on any errors
|
|
|
|
set -e
|
|
|
|
|
|
|
|
# local storage partition
|
|
|
|
echo "Unlocking storage partition:"
|
2024-05-05 17:50:27 +00:00
|
|
|
# 4 TB HDD, partition #2
|
|
|
|
cryptsetup luksOpen /dev/disk/by-uuid/8dc60329-d27c-4a4a-b76a-861b1e28400e storage
|
2024-02-29 14:53:34 +00:00
|
|
|
|
|
|
|
# mount local storage
|
|
|
|
if [ ! -f /dev/mapper/storage ]; then
|
|
|
|
mount /dev/mapper/storage /storage
|
|
|
|
|
|
|
|
if [ $? -eq "0" ]; then
|
|
|
|
echo "Storage and backup partitions mounted."
|
|
|
|
|
|
|
|
echo "Starting Duplicacy:"
|
|
|
|
systemctl start duplicacy-web.service
|
|
|
|
if [ $? -eq "0" ]; then
|
|
|
|
echo "Duplicacy started."
|
|
|
|
else
|
|
|
|
echo "Failed to start Duplicacy."
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "Starting SyncThing:"
|
2024-03-19 22:44:33 +00:00
|
|
|
systemctl --machine aires@.host --user start syncthing.service
|
2024-02-29 14:53:34 +00:00
|
|
|
if [ $? -eq "0" ]; then
|
|
|
|
echo "SyncThing started."
|
|
|
|
else
|
|
|
|
echo "Failed to start SyncThing."
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
echo "Failed to mount storage partition."
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
echo "Failed to unlock storage and/or backup partition(s)."
|
|
|
|
fi
|
|
|
|
|
|
|
|
exit 0
|