Skip to content

Commit 8a686aa

Browse files
committed
adds init scripts for new abroot version
1 parent ad4702d commit 8a686aa

File tree

3 files changed

+72
-1
lines changed

3 files changed

+72
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
#!/bin/bash
2+
3+
log() {
4+
local level="$1"
5+
local message="$2"
6+
echo "[abroot-unlock-var] ($level): $message"
7+
echo "[abroot-unlock-var] ($level): $message" > /dev/kmsg
8+
}
9+
10+
graphicalpwd() {
11+
local varunlockcmd="$1"
12+
13+
plymouth --ping
14+
if [[ "$?" -ne 0 ]]; then
15+
/usr/sbin/plymouthd
16+
fi
17+
18+
plymouth --show-splash
19+
20+
plymouth ask-for-password --prompt="Please enter passphrase to unlock your data." --command="$varunlockcmd" 2> /dev/kmsg
21+
if [[ "$?" -ne 0 ]]; then
22+
plymouth --quit
23+
log "warning" "falling back to cli password entry"
24+
clipwd
25+
return
26+
fi
27+
}
28+
29+
clipwd() {
30+
local varunlockcmd="$1"
31+
32+
$varunlockcmd
33+
}
34+
35+
/lib/systemd/systemd-udevd --daemon
36+
37+
deviceName=""
38+
39+
if [ -L "/dev/disk/by-label/vos-var" ]; then
40+
# var drive is not encrypted, just continue
41+
exit 0
42+
else
43+
if [ -L "/dev/mapper/vos--var-var" ]; then
44+
# var is encrypted LV
45+
deviceName="/dev/mapper/vos--var-var"
46+
elif [ -L "/dev/disk/by-partlabel/vos-var" ]; then
47+
# var is encrypted regular partition
48+
deviceName="$( realpath '/dev/disk/by-partlabel/vos-var' )"
49+
else
50+
log "error" "could not find var drive"
51+
exit 55
52+
fi
53+
fi
54+
55+
varunlockcmd="/usr/bin/abroot unlock-var --var-disk $deviceName"
56+
57+
if command -v plymouth &> /dev/null ; then
58+
log "info" "using plymouth password entry"
59+
graphicalpwd "$varunlockcmd"
60+
exit
61+
else
62+
log "info" "using cli password entry"
63+
clipwd "$varunlockcmd"
64+
exit
65+
fi
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/bash
2+
3+
abroot mount-sys 2> /dev/kmsg
4+
if [[ "$?" -ne 0 ]]; then
5+
exit 1
6+
fi

modules/150-init-executable.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ commands:
44
- rm /usr/sbin/init
55
- mv /usr/sbin/init.new /usr/sbin/init
66
- chmod +x /usr/sbin/init
7-
- chmod +x /usr/share/init.d/050-mount-tmp.sh
7+
- chmod +x /usr/share/init.d/*
88

0 commit comments

Comments
 (0)