summaryrefslogtreecommitdiff
path: root/src/initrd/btrfs-create.sh
diff options
context:
space:
mode:
authorAndrew Cady <d@jerkface.net>2017-03-26 07:30:09 -0400
committerAndrew Cady <d@jerkface.net>2017-03-26 07:49:54 -0400
commitc470b6ca6075b33c2c696ca34070671ee32a8d76 (patch)
tree782c311be2835b60c06e3dcc9892a63ad5793a6a /src/initrd/btrfs-create.sh
parent217713edcd3a27d21577f8c4765f5b0d89981c7b (diff)
Implement booting already-installed native install
This option is only available if the partitions have been renamed to indicate finalization of the install. The code that finalizes the install by renaming the partitions is available, but not yet run after the install.
Diffstat (limited to 'src/initrd/btrfs-create.sh')
-rw-r--r--src/initrd/btrfs-create.sh22
1 files changed, 18 insertions, 4 deletions
diff --git a/src/initrd/btrfs-create.sh b/src/initrd/btrfs-create.sh
index b5cc2c5..f31b14d 100644
--- a/src/initrd/btrfs-create.sh
+++ b/src/initrd/btrfs-create.sh
@@ -184,10 +184,18 @@ partition_new_hard_drive_DESTROYING_EVERYTHING()
184 udevadm settle 184 udevadm settle
185} 185}
186 186
187mark_partitions_as_complete()
188{
189 local dev="$1"
190 # TODO: Verify existing names
191 parted "$dev" -sm \
192 name 1 samizdat-grub \
193 name 2 samizdat-plaintext \
194 name 3 samizdat-luks-encrypted
195}
196
187open_samizdat() 197open_samizdat()
188{ 198{
189 local imgfile="$1" keyfile="$2"
190 open_samizdat_blockdev "$imgfile" "$keyfile" || return
191 local blockdev=/dev/mapper/samizdatcrypt fs 199 local blockdev=/dev/mapper/samizdatcrypt fs
192 200
193 # For this part, we don't necessarily need the cdrom. 201 # For this part, we don't necessarily need the cdrom.
@@ -211,12 +219,18 @@ init_samizdat_lodev()
211 echo "$dev" 219 echo "$dev"
212} 220}
213 221
214open_samizdat_blockdev() 222open_samizdat_blockdev_from_loop()
215{ 223{
216 local imgfile="$1" keyfile="$2" dev 224 local imgfile="$1" keyfile="$2" dev
217 local cryptname=samizdatcrypt
218 dev=$(losetup -f) && losetup "$dev" "$imgfile" || return 225 dev=$(losetup -f) && losetup "$dev" "$imgfile" || return
226 open_samizdat_blockdev "$dev" "$keyfile"
227}
219 228
229open_samizdat_blockdev()
230{
231 local dev="$1" keyfile="$2"
232
233 local cryptname=samizdatcrypt
220 gpg2 --verify "$keyfile" || return 234 gpg2 --verify "$keyfile" || return
221 # The first --decrypt merely strips the signature. The option is 235 # The first --decrypt merely strips the signature. The option is
222 # poorly named for that case. 236 # poorly named for that case.