Compare commits

..

No commits in common. "ee7849be8f899d85efcb15e3941b35cc13de7a7c" and "3fcffac8fbcad16abae6708dc0aed12d234cae1f" have entirely different histories.

4 changed files with 11 additions and 30 deletions

View File

@ -7,12 +7,6 @@ if [ -f $run_directory/.disabled ]; then
exit 0 exit 0
fi fi
if [[ $user != 'root' ]]; then
sudo="sudo"
else
sudo=""
fi
echo "Copying Systemd units to system directory..." echo "Copying Systemd units to system directory..."
for f in $run_directory/mounts.conf.d/*.conf; do for f in $run_directory/mounts.conf.d/*.conf; do
if [ ! -e "$f" ]; then if [ ! -e "$f" ]; then
@ -21,34 +15,25 @@ for f in $run_directory/mounts.conf.d/*.conf; do
source $f source $f
mountfile=$(echo ${mount[target]} | sed -e "s:/:-:g") mountfile=$(echo ${mount[target]} | sed -e "s:/:-:g")
mountfile=${mountfile:1}.mount mountfile=${mountfile:1}.mount
$sudo cp $run_directory/template.mount /etc/systemd/system/$mountfile sudo cp $run_directory/template.mount /etc/systemd/system/$mountfile
$sudo sed -i -e "s/PH_MAPPER/${mount[mapper]}/g" /etc/systemd/system/$mountfile sudo sed -i -e "s/PH_MAPPER/${mount[mapper]}/g" /etc/systemd/system/$mountfile
$sudo sed -i -e "s:PH_TARGET:${mount[target]}:g" /etc/systemd/system/$mountfile sudo sed -i -e "s:PH_TARGET:${mount[target]}:g" /etc/systemd/system/$mountfile
$sudo sed -i -e "s:PH_FSTYPE:${mount[type]}:g" /etc/systemd/system/$mountfile
if [ "${mount[friendly]}" != '' ]; then if [ "${mount[friendly]}" != '' ]; then
$sudo sed -i -e "s/PH_FRIENDLY/${mount[friendly]}/g" /etc/systemd/system/$mountfile sudo sed -i -e "s/PH_FRIENDLY/${mount[friendly]}/g" /etc/systemd/system/$mountfile
else else
$sudo sed -i -e "s/PH_FRIENDLY/${mount[mapper]}/g" /etc/systemd/system/$mountfile sudo sed -i -e "s/PH_FRIENDLY/${mount[mapper]}/g" /etc/systemd/system/$mountfile
fi fi
if [ ${mount[autolock]} -eq 1 ]; then if [ ${mount[autolock]} -eq 1 ]; then
if [ ! -d /etc/systemd/system/systemd-cryptsetup@${mount[mapper]}.service.d ]; then sudo mkdir /etc/systemd/system/systemd-cryptsetup@${mount[mapper]}.service.d
$sudo mkdir /etc/systemd/system/systemd-cryptsetup@${mount[mapper]}.service.d sudo cp $run_directory/close-vault.conf.template \
fi
$sudo cp $run_directory/close-vault.conf.template \
/etc/systemd/system/systemd-cryptsetup@${mount[mapper]}.service.d/close-vault.conf /etc/systemd/system/systemd-cryptsetup@${mount[mapper]}.service.d/close-vault.conf
$sudo sed -i -e "s/PH_MOUNTFILE/$mountfile/g" \ sudo sed -i -e "s/PH_MOUNTFILE/$mountfile/g" \
/etc/systemd/system/systemd-cryptsetup@${mount[mapper]}.service.d/close-vault.conf /etc/systemd/system/systemd-cryptsetup@${mount[mapper]}.service.d/close-vault.conf
fi fi
if [ ${mount[timeout]} -eq 1 ]; then
if [ ! -d /etc/systemd/system/systemd-cryptsetup@${mount[mapper]}.service.d ]; then
$sudo mkdir /etc/systemd/system/systemd-cryptsetup@${mount[mapper]}.service.d
fi
$sudo cp $run_directory/timeout.conf /etc/systemd/system/systemd-cryptsetup@${mount[mapper]}.service.d/timeout.conf
fi
done done
echo "Reloading Systemd..." echo "Reloading Systemd..."
$sudo systemctl daemon-reload sudo systemctl daemon-reload
echo "Finished install. Exiting..." echo "Finished install. Exiting..."
exit 0 exit 0

View File

@ -5,7 +5,5 @@
declare -A mount declare -A mount
mount[mapper]='' # As in /dev/mapper/<?> mount[mapper]='' # As in /dev/mapper/<?>
mount[target]='' # Mount point (absolute path) mount[target]='' # Mount point (absolute path)
mount[type]='ext4' # Filesystem type
mount[friendly]='' # Optional friendly name for unit file Description mount[friendly]='' # Optional friendly name for unit file Description
mount[autolock]=0 # Set to 1 to enable autolock mount[autolock]=0 # Set to 1 to enable autolock
mount[timeout]=0 # Set to 1 to enable mount timeout (30 seconds)

View File

@ -1,10 +1,10 @@
[Unit] [Unit]
Description=Mount PH_FRIENDLY Volume Description=Mount PH_FRIENDLY Volume
Wants=systemd-cryptsetup@PH_MAPPER.service # Below Requisite could be a Wants
Requisite=systemd-cryptsetup@PH_MAPPER.service
After=systemd-cryptsetup@PH_MAPPER.service After=systemd-cryptsetup@PH_MAPPER.service
[Mount] [Mount]
What=/dev/mapper/PH_MAPPER What=/dev/mapper/PH_MAPPER
Where=PH_TARGET Where=PH_TARGET
Type=PH_FSTYPE
Options=rw,relatime Options=rw,relatime

View File

@ -1,2 +0,0 @@
[Unit]
JobTimeoutSec=30