mirror of
https://github.com/kevinveenbirkenbach/linux-image-manager.git
synced 2024-11-24 08:01:03 +01:00
Compare commits
No commits in common. "796028670fbc28b27009d6fbaac0a6907c60efdb" and "93beadb519ca7f83a1f7f9a1f6e4d0b3605cb6c3" have entirely different histories.
796028670f
...
93beadb519
@ -95,28 +95,15 @@ set_device_path(){
|
|||||||
info "Optimal blocksize set to: $OPTIMAL_BLOCKSIZE" || error
|
info "Optimal blocksize set to: $OPTIMAL_BLOCKSIZE" || error
|
||||||
}
|
}
|
||||||
|
|
||||||
overwrite_device() {
|
overwritte_device_with_zeros(){
|
||||||
question "Should $device_path be overwritten with zeros before copying? (y/N/block count)" && read -r copy_zeros_to_device
|
question "Should $device_path be overwritten with zeros before copying?(y/N)" && read -r copy_zeros_to_device
|
||||||
case "$copy_zeros_to_device" in
|
if [ "$copy_zeros_to_device" = "y" ]
|
||||||
y)
|
then
|
||||||
info "Overwriting entire device..." &&
|
info "Overwritting..." &&
|
||||||
dd if=/dev/zero of="$device_path" bs="$OPTIMAL_BLOCKSIZE" status=progress || error "Overwriting $device_path failed."
|
dd if=/dev/zero of="$device_path" bs="$OPTIMAL_BLOCKSIZE" status=progress || error "Overwritting $device_path failed."
|
||||||
;;
|
else
|
||||||
N)
|
info "Skipping Overwritting..."
|
||||||
info "Skipping Overwriting..."
|
fi
|
||||||
;;
|
|
||||||
''|*[!0-9]*)
|
|
||||||
error "Invalid input."
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
if [[ "$copy_zeros_to_device" =~ ^[0-9]+$ ]]; then
|
|
||||||
info "Overwriting $copy_zeros_to_device blocks..." &&
|
|
||||||
dd if=/dev/zero of="$device_path" bs="$OPTIMAL_BLOCKSIZE" count="$copy_zeros_to_device" status=progress || error "Overwriting $device_path failed."
|
|
||||||
else
|
|
||||||
error "Invalid input. Block count must be a number."
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
}
|
}
|
||||||
|
|
||||||
get_packages(){
|
get_packages(){
|
||||||
|
@ -7,7 +7,7 @@ echo "Setups disk encryption"
|
|||||||
|
|
||||||
set_device_mount_partition_and_mapper_paths
|
set_device_mount_partition_and_mapper_paths
|
||||||
|
|
||||||
overwrite_device
|
overwritte_device_with_zeros
|
||||||
|
|
||||||
info "Creating new GPT partition table..."
|
info "Creating new GPT partition table..."
|
||||||
( echo "g" # create a new empty GPT partition table
|
( echo "g" # create a new empty GPT partition table
|
||||||
|
@ -69,21 +69,14 @@ case "$operation_system" in
|
|||||||
image_checksum="0E1BA7FFD14AAAE5F0462C8293D95B62C3BF1D9E726E26977BD04772C55680D3"
|
image_checksum="0E1BA7FFD14AAAE5F0462C8293D95B62C3BF1D9E726E26977BD04772C55680D3"
|
||||||
;;
|
;;
|
||||||
"arch")
|
"arch")
|
||||||
question "Which Raspberry Pi will be used (e.g.: 1, 2, 3, 4...):" && read -r version
|
question "Which Raspberry Pi will be used(e.g.:1,2,3,4,aarch64):" && read -r version
|
||||||
base_download_url="http://os.archlinuxarm.org/os/";
|
base_download_url="http://os.archlinuxarm.org/os/";
|
||||||
image_name="ArchLinuxARM-rpi-$version.tar.gz"
|
if [ "$version" == "1" ]
|
||||||
case "$version" in
|
then
|
||||||
"1")
|
|
||||||
image_name="ArchLinuxARM-rpi-latest.tar.gz"
|
image_name="ArchLinuxARM-rpi-latest.tar.gz"
|
||||||
;;
|
else
|
||||||
"2" | "3")
|
image_name="ArchLinuxARM-rpi-$version-latest.tar.gz"
|
||||||
image_name="ArchLinuxARM-rpi-armv7-latest.tar.gz"
|
fi
|
||||||
;;
|
|
||||||
|
|
||||||
"4")
|
|
||||||
image_name="ArchLinuxARM-rpi-aarch64-latest.tar.gz"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
;;
|
;;
|
||||||
"manjaro")
|
"manjaro")
|
||||||
question "Which version(e.g.:architect,gnome) should be used:" && read -r version
|
question "Which version(e.g.:architect,gnome) should be used:" && read -r version
|
||||||
@ -263,7 +256,7 @@ if [ "$transfer_image" = "y" ]
|
|||||||
info "Skipping partition table deletion..."
|
info "Skipping partition table deletion..."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
overwrite_device
|
overwritte_device_with_zeros
|
||||||
|
|
||||||
info "Starting image transfer..."
|
info "Starting image transfer..."
|
||||||
if [ "$distribution" = "arch" ]
|
if [ "$distribution" = "arch" ]
|
||||||
@ -409,35 +402,41 @@ if [ "$distribution" != "manjaro" ]
|
|||||||
|
|
||||||
copy_resolve_conf
|
copy_resolve_conf
|
||||||
|
|
||||||
question "Type in new password (leave empty to skip): " && read -r password_1
|
question "Should the password of the standart user \"$target_username\" be changed?(y/N)" && read -r change_password
|
||||||
|
if [ "$change_password" == "y" ]
|
||||||
if [ -n "$password_1" ]; then
|
then
|
||||||
question "Repeat new password for \"$target_username\": " && read -r password_2
|
|
||||||
if [ "$password_1" = "$password_2" ]; then
|
|
||||||
info "Changing passwords on target system..."
|
info "Changing passwords on target system..."
|
||||||
(
|
question "Type in new password: " && read -r password_1
|
||||||
echo "$password_1" | chroot "$root_mount_path" passwd --stdin "$target_username"
|
question "Repeat new password\"$target_username\"" && read -r password_2
|
||||||
echo "$password_1" | chroot "$root_mount_path" passwd --stdin
|
if [ "$password_1" = "$password_2" ]
|
||||||
) || error "Failed to change password."
|
then
|
||||||
|
(
|
||||||
|
echo "(
|
||||||
|
echo '$password_1'
|
||||||
|
echo '$password_1'
|
||||||
|
) | passwd $target_username"
|
||||||
|
echo "(
|
||||||
|
echo '$password_1'
|
||||||
|
echo '$password_1'
|
||||||
|
) | passwd"
|
||||||
|
) | chroot "$root_mount_path" /bin/bash || error
|
||||||
|
else
|
||||||
|
error "Passwords didn't match."
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
error "Passwords didn't match."
|
info "Skipped password change..."
|
||||||
fi
|
|
||||||
else
|
|
||||||
info "No password change requested, skipped password change..."
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
hostname_path="$root_mount_path""etc/hostname"
|
||||||
hostname_path="$root_mount_path/etc/hostname"
|
question "Should the hostname be changed?(y/N)" && read -r change_hostname
|
||||||
|
if [ "$change_hostname" == "y" ]
|
||||||
question "Type in the hostname (leave empty to skip): " && read -r target_hostname
|
then
|
||||||
|
question "Type in the hostname:" && read -r target_hostname;
|
||||||
if [ -n "$target_hostname" ]; then
|
echo "$target_hostname" > "$hostname_path" || error
|
||||||
echo "$target_hostname" > "$hostname_path" || error "Failed to set hostname."
|
else
|
||||||
else
|
target_hostname=$(cat "$hostname_path")
|
||||||
target_hostname=$(cat "$hostname_path")
|
info "Skipped hostname change..."
|
||||||
info "No hostname change requested, skipped hostname change..."
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
info "Used hostname is: $target_hostname"
|
info "Used hostname is: $target_hostname"
|
||||||
|
|
||||||
case "$distribution" in
|
case "$distribution" in
|
||||||
|
Loading…
Reference in New Issue
Block a user