2 # I, Ian Kelling, follow the GNU license recommendations at
3 # https://www.gnu.org/licenses/license-recommendations.en.html. They
4 # recommend that small programs, < 300 lines, be licensed under the
5 # Apache License 2.0. This file contains or is part of one or more small
6 # programs. If a small program grows beyond 300 lines, I plan to switch
9 # Copyright 2024 Ian Kelling
11 # Licensed under the Apache License, Version 2.0 (the "License");
12 # you may not use this file except in compliance with the License.
13 # You may obtain a copy of the License at
15 # http://www.apache.org/licenses/LICENSE-2.0
17 # Unless required by applicable law or agreed to in writing, software
18 # distributed under the License is distributed on an "AS IS" BASIS,
19 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20 # See the License for the specific language governing permissions and
21 # limitations under the License.
24 [[ $EUID == 0 ]] ||
exec sudo
-E "${BASH_SOURCE[0]}" "$@"
26 set -e; .
/usr
/local
/lib
/bash-bear
; set +e
29 # Explaining this whole thing. The host amy is used by someone else,
30 # i back it up to my extra big partition on one computer.
31 # But I also want to restore it and test out the restoration on
32 # a computer I usually use. For this, I created a separate partition
33 # that has the amy encryption password, and a separate boot so
34 # that I could encrypt my own boot partition if I want. Then,
35 # I backup from this big partition into that partition in order
38 ## In order to boot and run it:
42 if [[ ! -e /mnt
/root
/root2-fstab ||
! -e /mnt
/root
/root2-crypttab
]]; then
43 echo $0: "error: create /mnt/root/root2-fstab & /mnt/root/root2-crypttab from running /a/bin/fai/fai/config/hooks/partition.DEFAULT mkroot2 or mkroot2tab"
47 mount
-o bind /mnt
/root
2/root_ubuntubionic
/mnt
/1
49 /b
/ds
/gen-amy-fstab ubuntubionic .
50 teeu
/mnt
/1/etc
/default
/grub
<<<'GRUB_DISABLE_OS_PROBER=true'
51 mount -o bind /mnt/boot2/boot_ubuntubionic boot
52 mount -o bind /dev dev
53 mount -o bind /proc proc
54 mount -o bind /sys sys
56 mount "$(awk '$2 == "/boot/efi" {print $1}' /etc/mtab)" boot/efi
58 cp /b/ds/zboot-chroot ./root
60 chroot . ./root/zboot-chroot
62 echo "check output and reboot"