penguins-eggs 25.11.8 → 25.11.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.oclif.manifest.json +149 -140
- package/README.md +90 -132
- package/README.pdf +1343 -2331
- package/addons/eggs/adapt/applications/eggs-adapt.desktop +0 -0
- package/addons/eggs/pve/applications/eggs-pve.desktop +0 -0
- package/addons/eggs/rsupport/applications/eggs-rsupport.desktop +0 -0
- package/addons/eggs/theme/applications/install-system.desktop +0 -0
- package/assets/calamares/install-system.sh +0 -0
- package/assets/penguins-eggs.desktop +0 -0
- package/assets/penguins-krill.desktop +0 -0
- package/assets/penguins-links-add.desktop +0 -0
- package/assets/penguins-live-installer.desktop +0 -0
- package/bin/dev.js +0 -0
- package/conf/distros/alpine/calamares/calamares-modules/machineid-openrc/machineid-openrc.sh +0 -0
- package/conf/distros/archlinux/calamares/modules/bootloader.yml +1 -1
- package/conf/distros/archlinux/calamares/modules/partition.yml +385 -8
- package/conf/distros/buster/calamares/calamares-modules/cleanup/cleanup.sh +0 -0
- package/conf/distros/buster/calamares/calamares-modules/dpkg-unsafe-io/dpkg-unsafe-io.sh +0 -0
- package/conf/distros/buster/calamares/calamares-modules/sources-yolk/sources-yolk.sh +0 -0
- package/conf/distros/fedora/calamares/calamares-modules/bootloaderspecification/bootloaderspecification.sh +0 -0
- package/conf/distros/focal/calamares/calamares-modules/.keepit +0 -0
- package/conf/distros/focal/calamares/calamares-modules/cleanup/cleanup.sh +20 -0
- package/conf/distros/focal/calamares/calamares-modules/cleanup/module.yml +9 -0
- package/conf/distros/focal/calamares/calamares-modules/sources-yolk/module.yml +8 -0
- package/conf/distros/focal/calamares/calamares-modules/sources-yolk/sources-yolk.sh +50 -0
- package/conf/distros/focal/calamares/calamares-modules/sources-yolk-undo/module.yml +8 -0
- package/conf/distros/focal/calamares/libexec/.keepit +0 -0
- package/conf/distros/focal/calamares/libexec/README.md +5 -0
- package/conf/distros/focal/calamares/libexec/calamares-aptsources.sh +15 -0
- package/conf/distros/focal/calamares/libexec/calamares-l10n-helper.sh +38 -0
- package/conf/distros/focal/calamares/libexec/calamares-logs-helper.sh +34 -0
- package/conf/distros/focal/calamares/libexec/calamares-nomodeset.sh +19 -0
- package/conf/distros/focal/calamares/modules/after_bootloader_context.yml +26 -0
- package/conf/distros/focal/calamares/modules/before_bootloader_context.yml +12 -0
- package/conf/distros/focal/calamares/modules/bootloader.yml +86 -0
- package/conf/distros/focal/calamares/modules/bootloader.yml.old +35 -0
- package/conf/distros/focal/calamares/modules/displaymanager.yml +12 -0
- package/conf/distros/focal/calamares/modules/finished.yml +6 -0
- package/conf/distros/focal/calamares/modules/fstab.yml +63 -0
- package/conf/distros/focal/calamares/modules/grubcfg.yml +51 -0
- package/conf/distros/focal/calamares/modules/keyboard.yml +29 -0
- package/conf/distros/focal/calamares/modules/locale.yml +7 -0
- package/conf/distros/focal/calamares/modules/machineid.yml +10 -0
- package/conf/distros/focal/calamares/modules/mount.yml +20 -0
- package/conf/distros/focal/calamares/modules/netinstall.yml +5 -0
- package/conf/distros/focal/calamares/modules/packages.mustache +5 -0
- package/conf/distros/focal/calamares/modules/partition.yml +21 -0
- package/conf/distros/focal/calamares/modules/removeuser.mustache +3 -0
- package/conf/distros/focal/calamares/modules/shellprocess@aptsources.yml +11 -0
- package/conf/distros/focal/calamares/modules/shellprocess@boot_deploy.yml +9 -0
- package/conf/distros/focal/calamares/modules/shellprocess@boot_reconfigure.yml +15 -0
- package/conf/distros/focal/calamares/modules/shellprocess@install_translations.yml +8 -0
- package/conf/distros/focal/calamares/modules/shellprocess@logs.yml +8 -0
- package/conf/distros/focal/calamares/modules/shellprocess@mkinitramfs.yml +6 -0
- package/conf/distros/focal/calamares/modules/shellprocess@nomodeset.yml +12 -0
- package/conf/distros/focal/calamares/modules/umount.yml +4 -0
- package/conf/distros/focal/calamares/modules/unpackfs.mustache +6 -0
- package/conf/distros/focal/calamares/modules/users.yml +27 -0
- package/conf/distros/focal/calamares/modules/welcome.yml +24 -0
- package/conf/distros/focal/calamares/settings.yml +97 -0
- package/conf/distros/noble/calamares/calamares-modules/cleanup/cleanup.sh +0 -0
- package/conf/distros/noble/calamares/calamares-modules/sources-yolk/sources-yolk.sh +0 -0
- package/conf/distros/noble/calamares/libexec/calamares-aptsources.sh +0 -0
- package/conf/distros/noble/calamares/libexec/calamares-l10n-helper.sh +0 -0
- package/conf/distros/noble/calamares/libexec/calamares-logs-helper.sh +0 -0
- package/conf/distros/noble/calamares/libexec/calamares-nomodeset.sh +0 -0
- package/conf/distros/opensuse/calamares/calamares-modules/bootloaderspecification/bootloaderspecification.sh +0 -0
- package/conf/distros/opensuse/calamares/settings.yml +0 -0
- package/conf/distros/opensuse/calamares/zstd2lzo.sh +0 -0
- package/conf/distros/trixie/calamares/calamares-modules/cleanup/cleanup.sh +0 -0
- package/conf/distros/trixie/calamares/calamares-modules/dpkg-unsafe-io/dpkg-unsafe-io.sh +0 -0
- package/conf/distros/trixie/calamares/calamares-modules/sources-yolk/sources-yolk.sh +0 -0
- package/conf/init/unattended.sh +0 -0
- package/dist/appimage/first-run-check.d.ts +8 -0
- package/dist/appimage/first-run-check.js +13 -0
- package/dist/appimage/prerequisites.d.ts +34 -0
- package/dist/appimage/prerequisites.js +350 -0
- package/dist/bin/dev.cmd +3 -0
- package/dist/bin/dev.js +6 -0
- package/dist/bin/run.cmd +3 -0
- package/dist/bin/run.js +5 -0
- package/dist/classes/cli-autologin.js +4 -4
- package/dist/classes/distro.js +11 -27
- package/dist/classes/diversions.d.ts +5 -0
- package/dist/classes/diversions.js +23 -7
- package/dist/classes/incubation/customize/customize-partitions.js +8 -1
- package/dist/classes/incubation/fisherman-helper/packages.js +1 -1
- package/dist/classes/incubation/incubator.js +2 -2
- package/dist/classes/pacman.d/archlinux.js +5 -5
- package/dist/classes/pacman.d/debian.js +0 -2
- package/dist/classes/pacman.d/opensuse.js +2 -2
- package/dist/classes/pacman.js +10 -11
- package/dist/classes/utils.d.ts +4 -0
- package/dist/classes/utils.js +19 -3
- package/dist/commands/calamares.js +1 -1
- package/dist/commands/config.js +2 -2
- package/dist/commands/{analyze.d.ts → export/appimage.d.ts} +10 -9
- package/dist/commands/export/appimage.js +76 -0
- package/dist/commands/export/iso.js +1 -1
- package/dist/commands/export/pkg.d.ts +1 -1
- package/dist/commands/export/pkg.js +2 -2
- package/dist/commands/{install.d.ts → krill.d.ts} +3 -4
- package/dist/commands/{install.js → krill.js} +5 -6
- package/dist/commands/produce.js +1 -1
- package/dist/commands/setup.d.ts +21 -0
- package/dist/commands/setup.js +90 -0
- package/dist/commands/tools/repo.d.ts +0 -5
- package/dist/commands/tools/repo.js +205 -127
- package/dist/commands/update.d.ts +1 -1
- package/dist/commands/update.js +68 -59
- package/dist/krill/components/information.js +2 -2
- package/dist/krill/components/title.js +13 -13
- package/dist/lib/utils.d.ts +16 -0
- package/dist/lib/utils.js +24 -32
- package/dracut/create-symlink +0 -0
- package/dracut/export +0 -0
- package/dracut/export-dracut-analysis +0 -0
- package/dracut/export-dracut-log +0 -0
- package/dracut/mkisofs +0 -0
- package/dracut/modules.d/00debug-shell/debug-hook.sh +0 -0
- package/dracut/modules.d/00debug-shell/module-setup.sh +0 -0
- package/dracut/modules.d/90block/block-cmdline.sh +0 -0
- package/dracut/modules.d/90block/module-setup.sh +0 -0
- package/dracut/modules.d/95iso-scan/iso-scan-fallback.sh +0 -0
- package/dracut/modules.d/95iso-scan/iso-scan.sh +0 -0
- package/dracut/modules.d/95iso-scan/module-setup.sh +0 -0
- package/dracut/modules.d/95luks-loop/luks-loop.sh +0 -0
- package/dracut/modules.d/95luks-loop/module-setup.sh +0 -0
- package/dracut/renew-initramfs +0 -0
- package/dracut/sbin2bin +0 -0
- package/dracut/update-dracut-conf-d +0 -0
- package/dracut/update-dracut-modules +0 -0
- package/eui/eui-autostart-cinnamon.desktop +0 -0
- package/eui/eui-autostart-xfce.desktop +0 -0
- package/eui/eui-create-image.sh +0 -0
- package/eui/eui-start.sh +0 -0
- package/manpages/doc/man/eggs.1.gz +0 -0
- package/manpages/doc/man/eggs.html +582 -9
- package/package.json +125 -130
- package/perrisbrewery/scripts/postinst +0 -0
- package/perrisbrewery/scripts/postrm +0 -0
- package/perrisbrewery/scripts/preinst +0 -0
- package/perrisbrewery/scripts/prerm +0 -0
- package/perrisbrewery/template/dependencies.yaml +0 -5
- package/perrisbrewery/template/man.template.md +7 -0
- package/scripts/99clean +0 -0
- package/scripts/_eggs +28 -47
- package/scripts/adapt.sh +0 -0
- package/scripts/appimage-build.sh +152 -0
- package/scripts/appimage-install.sh +43 -0
- package/scripts/bros/waydroid-helper.sh +0 -0
- package/scripts/eggs.bash +3 -4
- package/scripts/lsb_release +0 -0
- package/scripts/mom.sh +0 -0
- package/scripts/pve-live.service +0 -0
- package/scripts/pve-live.sh +0 -0
- package/scripts/resy +0 -0
- package/dist/classes/distro-hossein.d.ts +0 -52
- package/dist/classes/distro-hossein.js +0 -239
- package/dist/classes/incubation/incubator.d/bionic.d.ts +0 -32
- package/dist/classes/incubation/incubator.d/bionic.js +0 -83
- package/dist/commands/analyze.js +0 -95
- package/dist/commands/pods.d.ts +0 -22
- package/dist/commands/pods.js +0 -92
- package/scripts/boot-encrypted-root.sh +0 -220
- package/scripts/mount-encrypted-home.sh +0 -324
|
@@ -1,220 +0,0 @@
|
|
|
1
|
-
#!/bin/sh
|
|
2
|
-
# /scripts/live-premount/boot-encrypted-root.sh
|
|
3
|
-
#
|
|
4
|
-
# This script is designed to Boot Encrypted Linux Live (BELL).
|
|
5
|
-
#
|
|
6
|
-
# Its main purpose is to find an encrypted root image file (root.img)
|
|
7
|
-
# on a live USB/DVD, ask the user for a passphrase to unlock it,
|
|
8
|
-
# and then copy the main system filesystem (filesystem.squashfs)
|
|
9
|
-
# from inside the encrypted image into RAM.
|
|
10
|
-
#
|
|
11
|
-
# the process continue with standard live-boot
|
|
12
|
-
|
|
13
|
-
# enable echo
|
|
14
|
-
# set -e
|
|
15
|
-
|
|
16
|
-
echo "BELL: Boot Encrypted Linux Live"
|
|
17
|
-
|
|
18
|
-
#################################################
|
|
19
|
-
# 1. Setup and Find Media
|
|
20
|
-
|
|
21
|
-
# 1.1 load modules
|
|
22
|
-
echo "BELL: loading modules..."
|
|
23
|
-
modprobe loop 2>/dev/null || true
|
|
24
|
-
modprobe dm_mod 2>/dev/null || true
|
|
25
|
-
modprobe dm_crypt 2>/dev/null || true
|
|
26
|
-
modprobe overlay 2>/dev/null || true
|
|
27
|
-
modprobe ext4 2>/dev/null || true
|
|
28
|
-
modprobe squashfs 2>/dev/null || true
|
|
29
|
-
sleep 2
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
# 1.2 find BELL media drive
|
|
33
|
-
echo "BELL: find BELL media drive..."
|
|
34
|
-
mkdir -p /mnt/live-media /mnt/ext4
|
|
35
|
-
BELL_MEDIA_MNT="/mnt/live-media"
|
|
36
|
-
LIVE_DEV=""
|
|
37
|
-
|
|
38
|
-
# find to max 20 devices
|
|
39
|
-
MAX_WAIT_DEV=20; COUNT_DEV=0
|
|
40
|
-
while [ -z "$LIVE_DEV" ] && [ $COUNT_DEV -lt $MAX_WAIT_DEV ]; do
|
|
41
|
-
ls /dev > /dev/null
|
|
42
|
-
for dev in /dev/sr* /dev/sd* /dev/vd* /dev/nvme*n*; do
|
|
43
|
-
if [ ! -b "$dev" ]; then continue; fi
|
|
44
|
-
if mount -o ro "$dev" "$BELL_MEDIA_MNT" 2>/dev/null; then
|
|
45
|
-
if [ -f "${BELL_MEDIA_MNT}/live/root.img" ]; then
|
|
46
|
-
echo "BELL: Found BELL media on $dev"
|
|
47
|
-
LIVE_DEV=$dev
|
|
48
|
-
break 2
|
|
49
|
-
else
|
|
50
|
-
umount "$BELL_MEDIA_MNT" 2>/dev/null || true
|
|
51
|
-
fi
|
|
52
|
-
fi
|
|
53
|
-
done
|
|
54
|
-
sleep 1
|
|
55
|
-
COUNT_DEV=$((COUNT_DEV+1))
|
|
56
|
-
done
|
|
57
|
-
|
|
58
|
-
if [ -z "$LIVE_DEV" ]; then
|
|
59
|
-
echo "BELL: Error: no live BELL drive found!"
|
|
60
|
-
ls /dev
|
|
61
|
-
exit 1
|
|
62
|
-
fi
|
|
63
|
-
|
|
64
|
-
ROOT_IMG_RO="${BELL_MEDIA_MNT}/live/root.img"
|
|
65
|
-
RAM_MEDIA_MNT="/run/live/medium" # final destination in RAM
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
#################################################
|
|
69
|
-
# 2. Prepare Encrypted Image
|
|
70
|
-
|
|
71
|
-
# 2.1 loop device
|
|
72
|
-
echo "BELL: loop device association for $ROOT_IMG_RO..."
|
|
73
|
-
LOOP_DEV_OUTPUT=$(/sbin/losetup -f --show "$ROOT_IMG_RO" 2>/dev/null); LOSETUP_EXIT_STATUS=$?
|
|
74
|
-
if [ $LOSETUP_EXIT_STATUS -ne 0 ] || [ -z "$LOOP_DEV_OUTPUT" ] || ! [ -b "$LOOP_DEV_OUTPUT" ]; then
|
|
75
|
-
echo "BELL: Error: loop association failed!"
|
|
76
|
-
exit 1
|
|
77
|
-
fi
|
|
78
|
-
LOOP_DEV="$LOOP_DEV_OUTPUT"
|
|
79
|
-
echo "BELL: loop device $ROOT_IMG_RO associated to: $LOOP_DEV"
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
#################################################
|
|
84
|
-
# 3. Unlock LUKS (User Interaction)
|
|
85
|
-
|
|
86
|
-
# disable 'set -e' to let 3 tempts
|
|
87
|
-
#set +e
|
|
88
|
-
MAX_ATTEMPTS=3
|
|
89
|
-
ATTEMPT=1
|
|
90
|
-
UNLOCKED=0
|
|
91
|
-
|
|
92
|
-
while [ $ATTEMPT -le $MAX_ATTEMPTS ]; do
|
|
93
|
-
|
|
94
|
-
# check if plymouth is active
|
|
95
|
-
if plymouth --ping 2>/dev/null; then
|
|
96
|
-
|
|
97
|
-
# request the password in plymouth and pass it to cryptsetup via stdin (--key-file -)
|
|
98
|
-
if plymouth ask-for-password --prompt="Enter passphrase ($ATTEMPT/$MAX_ATTEMPTS)" | cryptsetup open --readonly --key-file - "$LOOP_DEV" live-root; then
|
|
99
|
-
UNLOCKED=1
|
|
100
|
-
break
|
|
101
|
-
else
|
|
102
|
-
if [ $ATTEMPT -lt $MAX_ATTEMPTS ]; then
|
|
103
|
-
plymouth display-message --text="Incorrect passphrase. Try again..."
|
|
104
|
-
sleep 2 # wait 2 seconds to read message
|
|
105
|
-
fi
|
|
106
|
-
fi
|
|
107
|
-
else
|
|
108
|
-
# Fallback: Plymouth not active
|
|
109
|
-
echo "Please enter passphrase for $LOOP_DEV ($ATTEMPT/$MAX_ATTEMPTS):"
|
|
110
|
-
|
|
111
|
-
if cryptsetup open --readonly "$LOOP_DEV" live-root; then
|
|
112
|
-
UNLOCKED=1
|
|
113
|
-
break
|
|
114
|
-
else
|
|
115
|
-
if [ $ATTEMPT -lt $MAX_ATTEMPTS ]; then
|
|
116
|
-
echo "Incorrect passphrase. Please try again."
|
|
117
|
-
fi
|
|
118
|
-
fi
|
|
119
|
-
fi
|
|
120
|
-
|
|
121
|
-
ATTEMPT=$((ATTEMPT + 1))
|
|
122
|
-
sleep 1
|
|
123
|
-
done
|
|
124
|
-
|
|
125
|
-
# Enable echo
|
|
126
|
-
# set -e
|
|
127
|
-
|
|
128
|
-
# check if all attempts have failed
|
|
129
|
-
if [ $UNLOCKED -eq 0 ]; then
|
|
130
|
-
if plymouth --ping 2>/dev/null; then
|
|
131
|
-
plymouth display-message --text="LUKS Unlock Failed: Max attempts reached"
|
|
132
|
-
sleep 5
|
|
133
|
-
fi
|
|
134
|
-
/sbin/losetup -d "$LOOP_DEV" || true
|
|
135
|
-
exit 1
|
|
136
|
-
fi
|
|
137
|
-
|
|
138
|
-
echo "BELL: LUKS unlocked ($LOOP_DEV -> live-root) [readonly]. Waiting for mapper..."
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
#################################################
|
|
142
|
-
# 4. copy System to RAM
|
|
143
|
-
|
|
144
|
-
# 4.1 waiting mapper
|
|
145
|
-
MAX_WAIT_MAP=10; COUNT_MAP=0
|
|
146
|
-
while [ ! -b /dev/mapper/live-root ] && [ $COUNT_MAP -lt $MAX_WAIT_MAP ]; do
|
|
147
|
-
sleep 1
|
|
148
|
-
COUNT_MAP=$((COUNT_MAP+1))
|
|
149
|
-
done
|
|
150
|
-
|
|
151
|
-
if [ ! -b /dev/mapper/live-root ]; then
|
|
152
|
-
echo "BELL: Error: mapper did not appear."
|
|
153
|
-
cryptsetup close live-root || true
|
|
154
|
-
/sbin/losetup -d "$LOOP_DEV" || true
|
|
155
|
-
exit 1
|
|
156
|
-
fi
|
|
157
|
-
|
|
158
|
-
# 4.2 mount ext4 filesystem
|
|
159
|
-
echo "BELL: mounting ext4 filesystem..."
|
|
160
|
-
mount -t ext4 -o ro /dev/mapper/live-root /mnt/ext4
|
|
161
|
-
|
|
162
|
-
SQFS_SRC="/mnt/ext4/filesystem.squashfs"
|
|
163
|
-
if [ ! -f "$SQFS_SRC" ]; then
|
|
164
|
-
echo "BELL: error: $SQFS_SRC not found!"
|
|
165
|
-
exit 1
|
|
166
|
-
fi
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
# 4.3. Prepare RAM destination /run
|
|
170
|
-
echo "BELL: preparing RAM disk ${RAM_MEDIA_MNT}..."
|
|
171
|
-
SQFS_SIZE_BYTES=$(stat -c%s "$SQFS_SRC")
|
|
172
|
-
NEEDED_SIZE_MB=$(( $SQFS_SIZE_BYTES / 1024 / 1024 + 500 )) # add 500MB buffer
|
|
173
|
-
echo "BELL: Estimated space required in /run: ${NEEDED_SIZE_MB} MB"
|
|
174
|
-
echo "BELL: increase size /run (tmpfs)..."
|
|
175
|
-
if ! mount -o remount,size=${NEEDED_SIZE_MB}M /run; then
|
|
176
|
-
echo "BELL: WARN: Remount /run failed, space may be insufficient."
|
|
177
|
-
df -h /run
|
|
178
|
-
fi
|
|
179
|
-
mkdir -p "${RAM_MEDIA_MNT}/live"
|
|
180
|
-
|
|
181
|
-
# 4.4 copy ONLY filesystem.squashfs to RAM
|
|
182
|
-
SQFS_DEST="${RAM_MEDIA_MNT}/live/filesystem.squashfs"
|
|
183
|
-
echo "BELL: copying $SQFS_SRC -> $SQFS_DEST..."
|
|
184
|
-
if command -v rsync >/dev/null; then
|
|
185
|
-
rsync -a --info=progress2 "$SQFS_SRC" "$SQFS_DEST"
|
|
186
|
-
else
|
|
187
|
-
cp "$SQFS_SRC" "$SQFS_DEST"
|
|
188
|
-
fi
|
|
189
|
-
SQFS_SIZE=$(du -h "$SQFS_DEST" | cut -f1)
|
|
190
|
-
echo "BELL: filesystem.squashfs ($SQFS_SIZE) copied to RAM."
|
|
191
|
-
|
|
192
|
-
# 4.5 copy .disk
|
|
193
|
-
if [ -d "${BELL_MEDIA_MNT}/.disk" ]; then
|
|
194
|
-
cp -a "${BELL_MEDIA_MNT}/.disk" "${RAM_MEDIA_MNT}/"
|
|
195
|
-
echo "BELL: .disk copied."
|
|
196
|
-
else
|
|
197
|
-
echo "BELL: Warning: .disk not found."
|
|
198
|
-
fi
|
|
199
|
-
|
|
200
|
-
# 4.6 Copy vmlinuz and initrd (we need to install the system)
|
|
201
|
-
cp -a "${BELL_MEDIA_MNT}/live/vmlinuz"* "${RAM_MEDIA_MNT}/live/" 2>/dev/null || true
|
|
202
|
-
cp -a "${BELL_MEDIA_MNT}/live/initrd"* "${RAM_MEDIA_MNT}/live/" 2>/dev/null || true
|
|
203
|
-
echo "BELL: Attempted kernel/initrd copy (any errors ignored)."
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
#################################################
|
|
207
|
-
# 6. Cleanup and Hand-off
|
|
208
|
-
echo "BELL: cleaning used mounts and devices..."
|
|
209
|
-
umount /mnt/ext4 || echo "BELL: WARN: umount /mnt/ext4 failed ($?)"
|
|
210
|
-
cryptsetup close live-root || echo "BELL: WARN: cryptsetup close live-root failed ($?)"
|
|
211
|
-
/sbin/losetup -d "$LOOP_DEV" || echo "BELL: WARN: losetup -d $LOOP_DEV failed ($?)"
|
|
212
|
-
umount "$BELL_MEDIA_MNT" || echo "BELL: WARN: umount ${BELL_MEDIA_MNT} failed ($?)"
|
|
213
|
-
echo "BELL: cleaning complete."
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
# 6.1 switching to live boot
|
|
217
|
-
echo "BELL: live ISO image built in RAM on ${RAM_MEDIA_MNT}"
|
|
218
|
-
# ls -l "$RAM_MEDIA_MNT"
|
|
219
|
-
# ls -l "${RAM_MEDIA_MNT}/live"
|
|
220
|
-
exit 0
|
|
@@ -1,324 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
# This Bash script is used to unlock and mount a LUKS-encrypted home.img
|
|
3
|
-
# file for use as a /home directory, typically in a “live”
|
|
4
|
-
# operating system environment (booted from USB or DVD).
|
|
5
|
-
# v1.4 - Fixed 3-attempt loop by checking PIPESTATUS instead of pipe exit code.
|
|
6
|
-
# - Replaced non-breaking spaces with regular spaces.
|
|
7
|
-
|
|
8
|
-
# enable echo
|
|
9
|
-
set -e
|
|
10
|
-
|
|
11
|
-
# configuration
|
|
12
|
-
HOME_IMG="__HOME_IMG_PATH__"
|
|
13
|
-
LUKS_NAME="live-home"
|
|
14
|
-
MOUNT_POINT="/home"
|
|
15
|
-
|
|
16
|
-
# define path OverlayFS
|
|
17
|
-
# we will use /run che è un tmpfs (in RAM)
|
|
18
|
-
LOWER_DIR="/run/live-home-lower"
|
|
19
|
-
UPPER_DIR="/run/live-home-upper"
|
|
20
|
-
WORK_DIR="/run/live-home-work"
|
|
21
|
-
|
|
22
|
-
LOG_FILE="/var/log/mount-encrypted-home.log"
|
|
23
|
-
|
|
24
|
-
# logging
|
|
25
|
-
log() {
|
|
26
|
-
echo "[$(date '+%Y-%m-%d %H:%M:%S')] $1" | tee -a "$LOG_FILE"
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
log_error() {
|
|
30
|
-
echo "[$(date '+%Y-%m-%d %H:%M:%S')] ERROR: $1" | tee -a "$LOG_FILE" >&2
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
# Cleanup in caso di errore
|
|
34
|
-
cleanup() {
|
|
35
|
-
log "Cleanup in progress..."
|
|
36
|
-
if mountpoint -q "$MOUNT_POINT" 2>/dev/null; then
|
|
37
|
-
umount "$MOUNT_POINT" 2>/dev/null || true
|
|
38
|
-
fi
|
|
39
|
-
if mountpoint -q "$LOWER_DIR" 2>/dev/null; then
|
|
40
|
-
umount "$LOWER_DIR" 2>/dev/null || true
|
|
41
|
-
fi
|
|
42
|
-
if [ -e "/dev/mapper/$LUKS_NAME" ]; then
|
|
43
|
-
cryptsetup close "$LUKS_NAME" 2>/dev/null || true
|
|
44
|
-
fi
|
|
45
|
-
rmdir "$LOWER_DIR" "$UPPER_DIR" "$WORK_DIR" 2>/dev/null || true
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
trap cleanup EXIT
|
|
49
|
-
|
|
50
|
-
log "=== Starting encrypted home mount process (v1.4) ==="
|
|
51
|
-
|
|
52
|
-
# Check available memory
|
|
53
|
-
AVAILABLE_MEM=$(free -m | awk '/^Mem:/{print $7}')
|
|
54
|
-
log "Available memory: ${AVAILABLE_MEM}MB"
|
|
55
|
-
|
|
56
|
-
if [ "$AVAILABLE_MEM" -lt 1024 ]; then
|
|
57
|
-
log_error "Low memory warning: only ${AVAILABLE_MEM}MB available"
|
|
58
|
-
log "This might cause issues with LUKS operations"
|
|
59
|
-
fi
|
|
60
|
-
|
|
61
|
-
# Wait for the media to become available (max 30 seconds)
|
|
62
|
-
log "Waiting for live media to be available..."
|
|
63
|
-
COUNTER=0
|
|
64
|
-
while [ ! -f "$HOME_IMG" ] && [ $COUNTER -lt 30 ]; do
|
|
65
|
-
sleep 1
|
|
66
|
-
COUNTER=$((COUNTER + 1))
|
|
67
|
-
done
|
|
68
|
-
|
|
69
|
-
if [ ! -f "$HOME_IMG" ]; then
|
|
70
|
-
log_error "home.img not found at $HOME_IMG after 30 seconds"
|
|
71
|
-
log "Available mounts:"
|
|
72
|
-
mount | grep live | tee -a "$LOG_FILE"
|
|
73
|
-
exit 0
|
|
74
|
-
fi
|
|
75
|
-
|
|
76
|
-
log "Found home.img at $HOME_IMG"
|
|
77
|
-
|
|
78
|
-
# Check file size
|
|
79
|
-
IMG_SIZE=$(stat -c %s "$HOME_IMG")
|
|
80
|
-
log "home.img size: $((IMG_SIZE / 1024 / 1024))MB"
|
|
81
|
-
|
|
82
|
-
# Check if it is a LUKS volume
|
|
83
|
-
if ! cryptsetup isLuks "$HOME_IMG" 2>&1 | tee -a "$LOG_FILE"; then
|
|
84
|
-
log_error "$HOME_IMG is not a valid LUKS volume"
|
|
85
|
-
exit 1
|
|
86
|
-
fi
|
|
87
|
-
|
|
88
|
-
log "Verified: home.img is a valid LUKS volume"
|
|
89
|
-
|
|
90
|
-
# Wait until the TTY is fully initialized
|
|
91
|
-
sleep 2
|
|
92
|
-
|
|
93
|
-
# Clean up any previous device mappers
|
|
94
|
-
if [ -e "/dev/mapper/$LUKS_NAME" ]; then
|
|
95
|
-
log "LUKS device already exists, closing it first..."
|
|
96
|
-
cryptsetup close "$LUKS_NAME" 2>&1 | tee -a "$LOG_FILE" || true
|
|
97
|
-
fi
|
|
98
|
-
|
|
99
|
-
# PASSWORD REQUEST
|
|
100
|
-
# disable 'set -e' to let 3 tempts
|
|
101
|
-
set +e
|
|
102
|
-
|
|
103
|
-
MAX_ATTEMPTS=3
|
|
104
|
-
ATTEMPT=1
|
|
105
|
-
UNLOCKED=0 # Flag per sapere se abbiamo sbloccato
|
|
106
|
-
|
|
107
|
-
while [ $ATTEMPT -le $MAX_ATTEMPTS ]; do
|
|
108
|
-
log "Unlock attempt $ATTEMPT of $MAX_ATTEMPTS"
|
|
109
|
-
|
|
110
|
-
# Check if Plymouth is active
|
|
111
|
-
if plymouth --ping 2>/dev/null; then
|
|
112
|
-
log "Plymouth active. Asking for password via Plymouth..."
|
|
113
|
-
|
|
114
|
-
# Execute the command and check PIPESTATUS.
|
|
115
|
-
plymouth ask-for-password --prompt="Enter passphrase for /home ($ATTEMPT/$MAX_ATTEMPTS)" | cryptsetup open "$HOME_IMG" "$LUKS_NAME" --key-file - 2>&1 | tee -a "$LOG_FILE"
|
|
116
|
-
|
|
117
|
-
# Check the status of cryptsetup (index 1), not tee (index 2)
|
|
118
|
-
# PIPESTATUS[0] = plymouth, [1] = cryptsetup, [2] = tee
|
|
119
|
-
if [ ${PIPESTATUS[1]} -eq 0 ]; then
|
|
120
|
-
log "LUKS volume unlocked successfully via Plymouth"
|
|
121
|
-
UNLOCKED=1
|
|
122
|
-
break
|
|
123
|
-
else
|
|
124
|
-
log_error "Failed to unlock LUKS volume via Plymouth (attempt $ATTEMPT)"
|
|
125
|
-
if [ $ATTEMPT -lt $MAX_ATTEMPTS ]; then
|
|
126
|
-
plymouth display-message --text="Incorrect passphrase. Try again..."
|
|
127
|
-
sleep 2 # Gives time to read the message
|
|
128
|
-
fi
|
|
129
|
-
fi
|
|
130
|
-
else
|
|
131
|
-
# Fallback: Plymouth not active. asking for password via console
|
|
132
|
-
log "Plymouth not active. Asking for password via console..."
|
|
133
|
-
|
|
134
|
-
echo ""
|
|
135
|
-
echo "╔════════════════════════════════════════╗"
|
|
136
|
-
echo "║ Encrypted Home Directory Detected ║"
|
|
137
|
-
echo "╚════════════════════════════════════════╝"
|
|
138
|
-
echo ""
|
|
139
|
-
echo "Please enter your passphrase to unlock your data ($ATTEMPT/$MAX_ATTEMPTS)"
|
|
140
|
-
echo "(Press Ctrl+C to skip and continue with temporary home)"
|
|
141
|
-
echo ""
|
|
142
|
-
|
|
143
|
-
# Run the command and check PIPESTATUS
|
|
144
|
-
cryptsetup open "$HOME_IMG" "$LUKS_NAME" 2>&1 | tee -a "$LOG_FILE"
|
|
145
|
-
|
|
146
|
-
# Check the status of cryptsetup (index 0), not tee (index 1).
|
|
147
|
-
# PIPESTATUS[0] = cryptsetup, [1] = tee
|
|
148
|
-
if [ ${PIPESTATUS[0]} -eq 0 ]; then
|
|
149
|
-
log "LUKS volume unlocked successfully via console"
|
|
150
|
-
UNLOCKED=1
|
|
151
|
-
break
|
|
152
|
-
else
|
|
153
|
-
log_error "Failed to unlock LUKS volume (attempt $ATTEMPT)"
|
|
154
|
-
if [ $ATTEMPT -lt $MAX_ATTEMPTS ]; then
|
|
155
|
-
echo "Incorrect passphrase. Please try again."
|
|
156
|
-
fi
|
|
157
|
-
fi
|
|
158
|
-
fi
|
|
159
|
-
|
|
160
|
-
ATTEMPT=$((ATTEMPT + 1))
|
|
161
|
-
done
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
# Check if unlocking failed after all attempts
|
|
165
|
-
# Enable echo
|
|
166
|
-
set -e
|
|
167
|
-
|
|
168
|
-
if [ $UNLOCKED -eq 0 ]; then
|
|
169
|
-
log_error "Maximum attempts reached. Continuing without encrypted home."
|
|
170
|
-
echo ""
|
|
171
|
-
echo "╔════════════════════════════════════════╗"
|
|
172
|
-
echo "║ Failed to unlock encrypted home ║"
|
|
173
|
-
echo "║ System will continue with default ║"
|
|
174
|
-
echo "╚════════════════════════════════════════╝"
|
|
175
|
-
echo ""
|
|
176
|
-
|
|
177
|
-
if plymouth --ping 2>/dev/null; then
|
|
178
|
-
plymouth display-message --text="Failed to unlock. Continuing with temporary home..."
|
|
179
|
-
sleep 3
|
|
180
|
-
plymouth quit
|
|
181
|
-
fi
|
|
182
|
-
|
|
183
|
-
sleep 3
|
|
184
|
-
exit 0 # Exits without error, allowing the system to continue
|
|
185
|
-
fi
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
# Verify that the device mapper exists
|
|
189
|
-
if [ ! -e "/dev/mapper/$LUKS_NAME" ]; then
|
|
190
|
-
log_error "Device /dev/mapper/$LUKS_NAME not found after unlock"
|
|
191
|
-
exit 1
|
|
192
|
-
fi
|
|
193
|
-
|
|
194
|
-
log "LUKS device available at /dev/mapper/$LUKS_NAME"
|
|
195
|
-
|
|
196
|
-
# Implementing OverlayFS
|
|
197
|
-
# 1. Create all necessary mount points and directories
|
|
198
|
-
log "Creating overlay directories..."
|
|
199
|
-
mkdir -p "$LOWER_DIR" "$UPPER_DIR" "$WORK_DIR" "$MOUNT_POINT"
|
|
200
|
-
|
|
201
|
-
# 2. Mount the decrypted volume as read-only as 'lowerdir'
|
|
202
|
-
log "Mounting decrypted volume to $LOWER_DIR (read-only base)"
|
|
203
|
-
if ! mount -o ro "/dev/mapper/$LUKS_NAME" "$LOWER_DIR" 2>&1 | tee -a "$LOG_FILE"; then
|
|
204
|
-
log_error "Failed to mount decrypted volume (read-only) to $LOWER_DIR"
|
|
205
|
-
exit 1
|
|
206
|
-
fi
|
|
207
|
-
log "Read-only base mounted successfully."
|
|
208
|
-
|
|
209
|
-
# 3. create overlay read-write for /home
|
|
210
|
-
log "Mounting overlay filesystem to $MOUNT_POINT"
|
|
211
|
-
OVERLAY_OPTS="lowerdir=$LOWER_DIR,upperdir=$UPPER_DIR,workdir=$WORK_DIR"
|
|
212
|
-
# Add “index=off” and “metacopy=off” for compatibility
|
|
213
|
-
OVERLAY_OPTS="$OVERLAY_OPTS,index=off,metacopy=off"
|
|
214
|
-
|
|
215
|
-
if ! mount -t overlay -o "$OVERLAY_OPTS" overlay "$MOUNT_POINT" 2>&1 | tee -a "$LOG_FILE"; then
|
|
216
|
-
log_error "Failed to mount overlay filesystem to $MOUNT_POINT"
|
|
217
|
-
# Try without extra options if it fails
|
|
218
|
-
OVERLAY_OPTS="lowerdir=$LOWER_DIR,upperdir=$UPPER_DIR,workdir=$WORK_DIR"
|
|
219
|
-
log "Retrying overlay mount with basic options..."
|
|
220
|
-
if ! mount -t overlay -o "$OVERLAY_OPTS" overlay "$MOUNT_POINT" 2>&1 | tee -a "$LOG_FILE"; then
|
|
221
|
-
log_error "Failed to mount overlay filesystem to $MOUNT_POINT (retry failed)"
|
|
222
|
-
exit 1
|
|
223
|
-
fi
|
|
224
|
-
fi
|
|
225
|
-
log "Writable overlay for /home mounted successfully."
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
# Restore users if they exists
|
|
229
|
-
if [ -d "$MOUNT_POINT/.system-backup" ]; then
|
|
230
|
-
log "Restoring user accounts..."
|
|
231
|
-
|
|
232
|
-
# Remove temporary live user
|
|
233
|
-
if id live >/dev/null 2>&1; then
|
|
234
|
-
log "Removing temporary 'live' user"
|
|
235
|
-
userdel -r live 2>&1 | tee -a "$LOG_FILE" || true
|
|
236
|
-
fi
|
|
237
|
-
|
|
238
|
-
# Restore users
|
|
239
|
-
if [ -f "$MOUNT_POINT/.system-backup/passwd" ]; then
|
|
240
|
-
cat "$MOUNT_POINT/.system-backup/passwd" >> /etc/passwd
|
|
241
|
-
log "Restored $(wc -l < "$MOUNT_POINT/.system-backup/passwd") user entries"
|
|
242
|
-
fi
|
|
243
|
-
|
|
244
|
-
if [ -f "$MOUNT_POINT/.system-backup/shadow" ]; then
|
|
245
|
-
cat "$MOUNT_POINT/.system-backup/shadow" >> /etc/shadow
|
|
246
|
-
fi
|
|
247
|
-
|
|
248
|
-
# Restore groups (replace completely)
|
|
249
|
-
if [ -f "$MOUNT_POINT/.system-backup/group" ]; then
|
|
250
|
-
cp "$MOUNT_POINT/.system-backup/group" /etc/group
|
|
251
|
-
log "Restored group memberships"
|
|
252
|
-
fi
|
|
253
|
-
|
|
254
|
-
if [ -f "$MOUNT_POINT/.system-backup/gshadow" ]; then
|
|
255
|
-
cp "$MOUNT_POINT/.system-backup/gshadow" /etc/gshadow
|
|
256
|
-
fi
|
|
257
|
-
|
|
258
|
-
# Restore Display Manager configs for autologin
|
|
259
|
-
log "Restoring display manager configurations (for autologin)..."
|
|
260
|
-
|
|
261
|
-
# GDM (gdm3)
|
|
262
|
-
if [ -d "$MOUNT_POINT/.system-backup/gdm3" ]; then
|
|
263
|
-
log "Restoring GDM3 config..."
|
|
264
|
-
# Remove the default live configuration before copying
|
|
265
|
-
rm -rf /etc/gdm3 2>/dev/null
|
|
266
|
-
cp -a "$MOUNT_POINT/.system-backup/gdm3" /etc/
|
|
267
|
-
fi
|
|
268
|
-
|
|
269
|
-
# GDM (gdm)
|
|
270
|
-
if [ -d "$MOUNT_POINT/.system-backup/gdm" ]; then
|
|
271
|
-
log "Restoring GDM config..."
|
|
272
|
-
rm -rf /etc/gdm 2>/dev/null
|
|
273
|
-
cp -a "$MOUNT_POINT/.system-backup/gdm" /etc/
|
|
274
|
-
fi
|
|
275
|
-
|
|
276
|
-
# LightDM
|
|
277
|
-
if [ -d "$MOUNT_POINT/.system-backup/lightdm" ]; then
|
|
278
|
-
log "Restoring LightDM config..."
|
|
279
|
-
rm -rf /etc/lightdm 2>/dev/null
|
|
280
|
-
cp -a "$MOUNT_POINT/.system-backup/lightdm" /etc/
|
|
281
|
-
fi
|
|
282
|
-
|
|
283
|
-
# SDDM
|
|
284
|
-
if [ -f "$MOUNT_POINT/.system-backup/sddm.conf" ]; then
|
|
285
|
-
log "Restoring SDDM config (sddm.conf)..."
|
|
286
|
-
cp -a "$MOUNT_POINT/.system-backup/sddm.conf" /etc/
|
|
287
|
-
fi
|
|
288
|
-
if [ -d "$MOUNT_POINT/.system-backup/sddm.conf.d" ]; then
|
|
289
|
-
log "Restoring SDDM config (sddm.conf.d)..."
|
|
290
|
-
rm -rf /etc/sddm.conf.d 2>/dev/null
|
|
291
|
-
cp -a "$MOUNT_POINT/.system-backup/sddm.conf.d" /etc/
|
|
292
|
-
fi
|
|
293
|
-
|
|
294
|
-
log "User accounts and DM configs restored successfully"
|
|
295
|
-
|
|
296
|
-
# Restart the display manager to reload users
|
|
297
|
-
log "Restarting display manager..."
|
|
298
|
-
if systemctl is-active --quiet gdm; then
|
|
299
|
-
systemctl restart gdm 2>&1 | tee -a "$LOG_FILE"
|
|
300
|
-
log "GDM restarted"
|
|
301
|
-
elif systemctl is-active --quiet lightdm; then
|
|
302
|
-
systemctl restart lightdm 2>&1 | tee -a "$LOG_FILE"
|
|
303
|
-
log "LightDM restarted"
|
|
304
|
-
elif systemctl is-active --quiet sddm; then
|
|
305
|
-
systemctl restart sddm 2>&1 | tee -a "$LOG_FILE"
|
|
306
|
-
log "SDDM restarted"
|
|
307
|
-
else
|
|
308
|
-
log "No active display manager found to restart"
|
|
309
|
-
fi
|
|
310
|
-
else
|
|
311
|
-
log "No .system-backup directory found. Assuming /home is just data."
|
|
312
|
-
fi
|
|
313
|
-
|
|
314
|
-
log "=== Encrypted home mount completed successfully ==="
|
|
315
|
-
|
|
316
|
-
# Notify Plymouth (if active) that we are done
|
|
317
|
-
if plymouth --ping 2>/dev/null; then
|
|
318
|
-
plymouth quit
|
|
319
|
-
fi
|
|
320
|
-
|
|
321
|
-
# Don't clean up success
|
|
322
|
-
trap - EXIT
|
|
323
|
-
|
|
324
|
-
exit 0
|