diff --git a/README.md b/README.md index cfec90c..85e5d30 100644 --- a/README.md +++ b/README.md @@ -98,6 +98,7 @@ To pase the configuration to the program use this syntax: echo "n" # | Should the ssh-key be copied to the image?(y/N) echo "n" # |Should the hostname be changed?(y/N) #echo "example-host" # | The hostname + echo "y" # Should the image system be updated?(y/N) #echo "y" # | Setup Wifi on target system - Not implemented yet )| sudo bash ./scripts/image/setup.sh | tee log.txt ``` diff --git a/scripts/image/chroot.sh b/scripts/image/chroot.sh index f0c83a1..19ced40 100644 --- a/scripts/image/chroot.sh +++ b/scripts/image/chroot.sh @@ -4,6 +4,12 @@ # shellcheck disable=SC2154 # Deactivate not referenced link source "$(dirname "$(readlink -f "${0}")")/base.sh" || (echo "Loading base.sh failed." && exit 1) +destructor(){ + info "Unmount everything" && + umount "$root_mount_path"/{dev/pts,dev,sys,proc,boot,} $boot_mount_path|| + warning "Failed." +} + info "Starting chroot..." set_device_path @@ -26,6 +32,4 @@ info "Bash shell starts..." && chroot "$root_mount_path" /bin/bash || error -info "unmount everything" && -umount "$root_mount_path"/{dev/pts,dev,sys,proc,boot,} || -error +destructor diff --git a/scripts/image/setup.sh b/scripts/image/setup.sh index 6cccc9a..203bea5 100644 --- a/scripts/image/setup.sh +++ b/scripts/image/setup.sh @@ -349,10 +349,7 @@ if [ "$change_password" == "y" ] else info "Skipped password change..." fi -# @todo add to chroot -#pacman-key --init -#pacman-key --populate archlinuxarm -#pacman -Syyu + question "Should the hostname be changed?(y/N)" && read -r change_hostname if [ "$change_hostname" == "y" ] then @@ -361,6 +358,16 @@ if [ "$change_hostname" == "y" ] else info "Skipped hostname change..." fi + +question "Should the image system be updated?(y/N)" && read -r update_system +if [ "$update_system" == "y" ] + then + ( + echo "yes | pacman-key --init" + echo "yes | pacman-key --populate archlinuxarm" + echo "yes | pacman -Syyu" + ) | chroot "$root_mount_path" /bin/bash || error "Password change failed." +fi # question "Do you want to copy all Wifi passwords to the device?(y/n)" && read -r copy_wifi # if [ "$copy_wifi" = "y" ] # then