mirror of
https://github.com/kevinveenbirkenbach/raspberry-pi-tools.git
synced 2024-11-26 03:44:44 +01:00
In between commit chroot development
This commit is contained in:
parent
40b9034b50
commit
5306287463
16
sd_setup.sh
16
sd_setup.sh
@ -43,7 +43,10 @@ destructor(){
|
|||||||
|
|
||||||
error(){
|
error(){
|
||||||
message "${red_color}" "ERROR" "$1 -> Leaving program."
|
message "${red_color}" "ERROR" "$1 -> Leaving program."
|
||||||
destructor
|
if [ "$2" != "no_destructor" ]
|
||||||
|
then
|
||||||
|
destructor
|
||||||
|
fi
|
||||||
exit 1;
|
exit 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -191,8 +194,8 @@ if [[ -v image_checksum ]]
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
info "Preparing mount paths..."
|
info "Preparing mount paths..."
|
||||||
boot_mount_path="$working_folder""boot"
|
boot_mount_path="$working_folder""boot/"
|
||||||
root_mount_path="$working_folder""root"
|
root_mount_path="$working_folder""root/"
|
||||||
mkdir -v "$boot_mount_path"
|
mkdir -v "$boot_mount_path"
|
||||||
mkdir -v "$root_mount_path"
|
mkdir -v "$root_mount_path"
|
||||||
|
|
||||||
@ -309,6 +312,13 @@ if [ -f "$origin_user_rsa_pub" ]
|
|||||||
warning "The ssh key \"$origin_user_rsa_pub\" can't be copied to \"$target_authorized_keys\" because it doesn't exist."
|
warning "The ssh key \"$origin_user_rsa_pub\" can't be copied to \"$target_authorized_keys\" because it doesn't exist."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
info "Start chroot procedures..."
|
||||||
|
info "Mount chroot environments..."
|
||||||
|
mount --bind /dev "$root_mount_path""dev/" || error "Mounting /dev failed." "no_destructor"
|
||||||
|
mount --bind /sys "$root_mount_path""sys/" || error "Mounting /sys failed." "no_destructor"
|
||||||
|
mount --bind /proc "$root_mount_path""proc/" || error "Mounting /proc failed." "no_destructor"
|
||||||
|
mount --bind /dev/pts "$root_mount_path""dev/pts" || error "Mounting /dev/pts failed." "no_destructor"
|
||||||
|
|
||||||
info "Change password of user \"$target_username\"..."
|
info "Change password of user \"$target_username\"..."
|
||||||
(chroot "$root_mount_path" /bin/passwd "$target_username") || error "Password change for \"$target_username\" wasn't possible."
|
(chroot "$root_mount_path" /bin/passwd "$target_username") || error "Password change for \"$target_username\" wasn't possible."
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user