fix bash execution in run

This commit is contained in:
Mats van Reenen 2022-09-11 12:51:13 +02:00 committed by GitHub
parent 53f24b6ecb
commit b7990dc035
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -6,11 +6,11 @@ function run(){
echo "[ ] $1"
echo "# $1" >>install.log
echo "> $2" >>install.log
$2 &>>install.log \
bash -c "$2" &>>install.log \
&& echo -e "\e[1A\e[K[ \e[32mOK\e[0m ] $1" \
|| {
echo -e "\e[1A\e[K[\e[31mFAIL\e[0m] $1"
$3
bash -c "$3"
exit
}
echo >>install.log
@ -34,10 +34,10 @@ echo "127.0.1.1 $HOSTNAME" >>/etc/hosts
run "config initramfs" "sed --in-place -e 's/HOOKS=(.*)/HOOKS=(base udev autodetect keyboard keymap modconf block encrypt filesystems fsck)/' /etc/mkinitcpio.conf"
run "generate initramfs" "mkinitcpio -P"
DISKUUID=$(blkid --output export &{DISK}10 | grep PARTUUID | sed 's/PARTUUID=//')
DISKUUID=$(blkid --output export ${DISK}10 | grep PARTUUID | sed 's/PARTUUID=//')
run "run grub-install" "grub-install --target=x86_64-efi --bootloader-id=GRUB --efi-directory=/boot"
run "grub: enable crypt disk" "sed --in-place -E -e 's/#?GRUB_ENABLE_CRYPTODISK=(.*)/GRUB_ENABLE_CRYPTODISK=y/' /etc/default/grub"
run "grub: crypt disk map" "sed --in-place -E -e 's/#?GRUB_CMDLINE_LINUX=\"?(.*)\"?/GRUB_CMDLINE_LINUX=\"${DISKUUID}:cryptroot \1\"/' /etc/default/grub"
run "grub: crypt disk map" "sed --in-place -E -e 's/#?GRUB_CMDLINE_LINUX=\\\"?(.*)\\\"?/GRUB_CMDLINE_LINUX=\\\"/dev/disk/by-uuid/${DISKUUID}:cryptroot \\\1\\\"/' /etc/default/grub"
run "make grub config" "grub-mkconfig -o /boot/grub/grub.cfg"
run "add .ssh dir to skel" "mkdir /etc/skel/.ssh"