-
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adds init scripts for new abroot version
- Loading branch information
Showing
3 changed files
with
72 additions
and
1 deletion.
There are no files selected for viewing
65 changes: 65 additions & 0 deletions
65
includes.container/usr/share/init.d/090-abroot-unlock-var.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
#!/bin/bash | ||
|
||
log() { | ||
local level="$1" | ||
local message="$2" | ||
echo "[abroot-unlock-var] ($level): $message" | ||
echo "[abroot-unlock-var] ($level): $message" > /dev/kmsg | ||
} | ||
|
||
graphicalpwd() { | ||
local varunlockcmd="$1" | ||
|
||
plymouth --ping | ||
if [[ "$?" -ne 0 ]]; then | ||
/usr/sbin/plymouthd | ||
fi | ||
|
||
plymouth --show-splash | ||
|
||
plymouth ask-for-password --prompt="Please enter passphrase to unlock your data." --command="$varunlockcmd" 2> /dev/kmsg | ||
if [[ "$?" -ne 0 ]]; then | ||
plymouth --quit | ||
log "warning" "falling back to cli password entry" | ||
clipwd | ||
return | ||
fi | ||
} | ||
|
||
clipwd() { | ||
local varunlockcmd="$1" | ||
|
||
$varunlockcmd | ||
} | ||
|
||
/lib/systemd/systemd-udevd --daemon | ||
|
||
deviceName="" | ||
|
||
if [ -L "/dev/disk/by-label/vos-var" ]; then | ||
# var drive is not encrypted, just continue | ||
exit 0 | ||
else | ||
if [ -L "/dev/mapper/vos--var-var" ]; then | ||
# var is encrypted LV | ||
deviceName="/dev/mapper/vos--var-var" | ||
elif [ -L "/dev/disk/by-partlabel/vos-var" ]; then | ||
# var is encrypted regular partition | ||
deviceName="$( realpath '/dev/disk/by-partlabel/vos-var' )" | ||
else | ||
log "error" "could not find var drive" | ||
exit 55 | ||
fi | ||
fi | ||
|
||
varunlockcmd="/usr/bin/abroot unlock-var --var-disk $deviceName" | ||
|
||
if command -v plymouth &> /dev/null ; then | ||
log "info" "using plymouth password entry" | ||
graphicalpwd "$varunlockcmd" | ||
exit | ||
else | ||
log "info" "using cli password entry" | ||
clipwd "$varunlockcmd" | ||
exit | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/bash | ||
|
||
abroot mount-sys 2> /dev/kmsg | ||
if [[ "$?" -ne 0 ]]; then | ||
exit 1 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters