mirror of
https://github.com/kevinveenbirkenbach/linux-image-manager.git
synced 2024-11-14 03:21:03 +01:00
Deactivated code for manjaro
This commit is contained in:
parent
8a4f9012e1
commit
f711d7894f
@ -233,248 +233,250 @@ if [ "$transfer_image" = "y" ]
|
||||
info "Skipping image transfer..."
|
||||
fi
|
||||
|
||||
info "Start regular mounting procedure..."
|
||||
if mount | grep -q "$boot_partition_path"
|
||||
if [ "$os" != "manjaro" ]
|
||||
then
|
||||
info "$boot_partition_path is allready mounted..."
|
||||
else
|
||||
if mount | grep -q "$root_mapper_path"
|
||||
then
|
||||
info "$root_mapper_path is allready mounted..."
|
||||
else
|
||||
decrypt_root
|
||||
mount_partitions
|
||||
fi
|
||||
fi
|
||||
|
||||
fstab_path="$root_mount_path""etc/fstab" &&
|
||||
fstab_search_string=$(echo "/dev/mmcblk0p1"| sed -e 's/[\/&]/\\&/g') &&
|
||||
fstab_replace_string=$(echo "UUID=$boot_partition_uuid"| sed -e 's/[\/&]/\\&/g') &&
|
||||
info "Seeding UUID to $fstab_path to avoid path conflicts..." &&
|
||||
sed -i "s/$fstab_search_string/$fstab_replace_string/g" "$fstab_path" &&
|
||||
info "Content of $fstab_path:$(cat "$fstab_path")" || error
|
||||
|
||||
info "Define target paths..." &&
|
||||
target_home_path="$root_mount_path""home/" &&
|
||||
target_username=$(ls "$target_home_path") &&
|
||||
target_user_home_folder_path="$target_home_path$target_username/" &&
|
||||
target_user_ssh_folder_path="$target_user_home_folder_path"".ssh/" &&
|
||||
target_authorized_keys="$target_user_ssh_folder_path""authorized_keys" &&
|
||||
question "Should the ssh-key be copied to the image?(y/N)" && read -r copy_ssh_key || error
|
||||
if [ "$copy_ssh_key" == "y" ]
|
||||
then
|
||||
info "Copy ssh key to target..." &&
|
||||
origin_user_rsa_pub="$origin_user_home"".ssh/id_rsa.pub" || error
|
||||
if [ -f "$origin_user_rsa_pub" ]
|
||||
then
|
||||
mkdir -v "$target_user_ssh_folder_path" || warning "Folder \"$target_user_ssh_folder_path\" exists. Can't be created."
|
||||
cat "$origin_user_rsa_pub" > "$target_authorized_keys" &&
|
||||
target_authorized_keys_content=$(cat "$target_authorized_keys") &&
|
||||
info "$target_authorized_keys contains the following: $target_authorized_keys_content" &&
|
||||
chown -vR 1000 "$target_user_ssh_folder_path" &&
|
||||
chmod -v 700 "$target_user_ssh_folder_path" &&
|
||||
chmod -v 600 "$target_authorized_keys" || error
|
||||
else
|
||||
warning "The ssh key \"$origin_user_rsa_pub\" can't be copied to \"$target_authorized_keys\" because it doesn't exist."
|
||||
fi
|
||||
else
|
||||
info "Skipped SSH-key copying.."
|
||||
fi
|
||||
|
||||
info "Start chroot procedures..."
|
||||
|
||||
mount_chroot_binds
|
||||
|
||||
copy_qemu
|
||||
|
||||
copy_resolve_conf
|
||||
|
||||
question "Should the password of the standart user \"$target_username\" be changed?(y/N)" && read -r change_password
|
||||
if [ "$change_password" == "y" ]
|
||||
then
|
||||
info "Changing passwords on target system..."
|
||||
question "Type in new password: " && read -r password_1
|
||||
question "Repeat new password\"$target_username\"" && read -r password_2
|
||||
if [ "$password_1" = "$password_2" ]
|
||||
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
|
||||
info "Skipped password change..."
|
||||
fi
|
||||
|
||||
hostname_path="$root_mount_path""etc/hostname"
|
||||
question "Should the hostname be changed?(y/N)" && read -r change_hostname
|
||||
if [ "$change_hostname" == "y" ]
|
||||
then
|
||||
question "Type in the hostname:" && read -r target_hostname;
|
||||
echo "$target_hostname" > "$hostname_path" || error
|
||||
else
|
||||
target_hostname=$(cat "$hostname_path")
|
||||
info "Skipped hostname change..."
|
||||
fi
|
||||
info "Used hostname is: $target_hostname"
|
||||
|
||||
case "$os" in
|
||||
"arch"|"manjaro")
|
||||
info "Populating keys..." &&
|
||||
(
|
||||
echo "yes | pacman-key --init"
|
||||
echo "yes | pacman-key --populate archlinuxarm"
|
||||
) | chroot "$root_mount_path" /bin/bash || error
|
||||
;;
|
||||
esac
|
||||
|
||||
question "Should the system be updated?(y/N)" && read -r update_system
|
||||
if [ "$update_system" == "y" ]
|
||||
then
|
||||
info "Updating system..."
|
||||
case "$os" in
|
||||
"arch"|"manjaro")
|
||||
echo "pacman --noconfirm -Syyu" | chroot "$root_mount_path" /bin/bash || error
|
||||
;;
|
||||
"moode"|"retropie")
|
||||
(
|
||||
echo "yes | apt update"
|
||||
echo "yes | apt upgrade"
|
||||
) | chroot "$root_mount_path" /bin/bash || error
|
||||
;;
|
||||
*)
|
||||
warning "System update for operation system \"$os\" is not supported yet. Skipped."
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
info "Installing software for filesystem $root_filesystem..."
|
||||
if [ "$root_filesystem" == "btrfs" ]
|
||||
then
|
||||
install "btrfs-progs"
|
||||
else
|
||||
info "Skipped."
|
||||
fi
|
||||
|
||||
if [ "$encrypt_system" == "y" ]
|
||||
then
|
||||
# Adapted this instruction for setting up encrypted systems @see https://gist.github.com/gea0/4fc2be0cb7a74d0e7cc4322aed710d38
|
||||
info "Setup encryption..." &&
|
||||
|
||||
info "Installing neccessary software..." &&
|
||||
install "$(get_packages "server/luks")" &&
|
||||
|
||||
dropbear_root_key_path="$root_mount_path""etc/dropbear/root_key" &&
|
||||
info "Adding $target_authorized_keys to dropbear..." &&
|
||||
cp -v "$target_authorized_keys" "$dropbear_root_key_path" &&
|
||||
|
||||
#Concerning mkinitcpio warning @see https://gist.github.com/imrvelj/c65cd5ca7f5505a65e59204f5a3f7a6d
|
||||
mkinitcpio_path="$root_mount_path""etc/mkinitcpio.conf" &&
|
||||
info "Configuring $mkinitcpio_path..." &&
|
||||
mkinitcpio_search_modules="MODULES=()" &&
|
||||
mkinitcpio_replace_modules="MODULES=(g_cdc usb_f_acm usb_f_ecm smsc95xx g_ether)" &&
|
||||
mkinitcpio_search_binaries="BINARIES=()" &&
|
||||
mkinitcpio_replace_binaries=$(echo "BINARIES=(/usr/lib/libgcc_s.so.1)"| sed -e 's/[\/&]/\\&/g') &&
|
||||
mkinitcpio_encrypt_hooks="sleep netconf dropbear encryptssh" &&
|
||||
mkinitcpio_search_hooks="HOOKS=(base udev autodetect modconf block filesystems keyboard fsck)" &&
|
||||
mkinitcpio_replace_hooks="HOOKS=(base udev autodetect modconf block $mkinitcpio_encrypt_hooks filesystems keyboard fsck)" &&
|
||||
sed -i "s/$mkinitcpio_search_modules/$mkinitcpio_replace_modules/g" "$mkinitcpio_path" &&
|
||||
sed -i "s/$mkinitcpio_search_binaries/$mkinitcpio_replace_binaries/g" "$mkinitcpio_path" &&
|
||||
sed -i "s/$mkinitcpio_search_hooks/$mkinitcpio_replace_hooks/g" "$mkinitcpio_path" &&
|
||||
info "Content of $mkinitcpio_path:$(cat "$mkinitcpio_path")" &&
|
||||
info "Generating mkinitcpio..." &&
|
||||
echo "mkinitcpio -vP" | chroot "$root_mount_path" /bin/bash &&
|
||||
|
||||
fstab_insert_line="UUID=$root_partition_uuid / $root_filesystem defaults,noatime 0 1" &&
|
||||
info "Configuring $fstab_path..." || error
|
||||
if grep -q "$fstab_insert_line" "$fstab_path"
|
||||
then
|
||||
warning "$fstab_path contains allready $fstab_insert_line - Skipped."
|
||||
else
|
||||
echo "$fstab_insert_line" >> "$fstab_path" || error
|
||||
fi
|
||||
info "Content of $fstab_path:$(cat "$fstab_path")" &&
|
||||
|
||||
crypttab_path="$root_mount_path""etc/crypttab" &&
|
||||
crypttab_insert_line="$root_mapper_name UUID=$root_partition_uuid none luks" &&
|
||||
info "Configuring $crypttab_path..." || error
|
||||
if grep -q "$crypttab_insert_line" "$crypttab_path"
|
||||
then
|
||||
warning "$crypttab_path contains allready $crypttab_insert_line - Skipped."
|
||||
else
|
||||
echo "$crypttab_insert_line" >> "$crypttab_path" || error
|
||||
fi
|
||||
info "Content of $crypttab_path:$(cat "$crypttab_path")" &&
|
||||
|
||||
boot_txt_path="$boot_mount_path""boot.txt" &&
|
||||
cryptdevice_configuration="cryptdevice=UUID=$root_partition_uuid:$root_mapper_name root=$root_mapper_path" || error
|
||||
if [ -f "$boot_txt_path" ];
|
||||
then
|
||||
info "Configuring $boot_txt_path..." &&
|
||||
boot_txt_delete_line=$(echo "part uuid \${devtype} \${devnum}:2 uuid" | sed -e 's/[]\/$*.^[]/\\&/g') &&
|
||||
boot_txt_setenv_origin=$(echo "setenv bootargs console=ttyS1,115200 console=tty0 root=PARTUUID=\${uuid} rw rootwait smsc95xx.macaddr=\"\${usbethaddr}\"" | sed -e 's/[]\/$*.^[]/\\&/g') &&
|
||||
boot_txt_setenv_replace=$(echo "setenv bootargs console=ttyS1,115200 console=tty0 ip=::::$target_hostname:eth0:dhcp $cryptdevice_configuration rw rootwait smsc95xx.macaddr=\"\${usbethaddr}\""| sed -e 's/[\/&]/\\&/g') &&
|
||||
sed -i "s/$boot_txt_delete_line//g" "$boot_txt_path" &&
|
||||
sed -i "s/$boot_txt_setenv_origin/$boot_txt_setenv_replace/g" "$boot_txt_path" &&
|
||||
info "Content of $boot_txt_path:$(cat "$boot_txt_path")" &&
|
||||
info "Generating..." &&
|
||||
echo "cd /boot/ && ./mkscr || exit 1" | chroot "$root_mount_path" /bin/bash || error
|
||||
else
|
||||
cmdline_txt_path="$boot_mount_path""cmdline.txt" &&
|
||||
info "Configuring $cmdline_txt_path..." &&
|
||||
cmdline_search_string=$(echo "root=/dev/mmcblk0p2" | sed -e 's/[\/&]/\\&/g') &&
|
||||
cmdline_replace_string=$(echo "$cryptdevice_configuration rootfstype=$root_filesystem"| sed -e 's/[\/&]/\\&/g') &&
|
||||
sed -i "s/$cmdline_search_string/$cmdline_replace_string/g" "$cmdline_txt_path" &&
|
||||
info "Content of $cmdline_txt_path:$(cat "$cmdline_txt_path")" || error
|
||||
info "Start regular mounting procedure..."
|
||||
if mount | grep -q "$boot_partition_path"
|
||||
then
|
||||
info "$boot_partition_path is allready mounted..."
|
||||
else
|
||||
if mount | grep -q "$root_mapper_path"
|
||||
then
|
||||
info "$root_mapper_path is allready mounted..."
|
||||
else
|
||||
decrypt_root
|
||||
mount_partitions
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
question "Do you want to setup Wifi on the device?(y/N)" && read -r setup_wifi
|
||||
if [ "$setup_wifi" = "y" ]
|
||||
then
|
||||
question "Please type in the ssid:" && read -r ssid
|
||||
question "Please type in the psk:" && read -r psk
|
||||
case "$os" in
|
||||
"retropie")
|
||||
wifi_file="$boot_mount_path""wifikeyfile.txt" &&
|
||||
echo "ssid=\"$ssid\"" > "$wifi_file" &&
|
||||
echo "psk=\"$psk\"" >> "$wifi_file" || error
|
||||
;;
|
||||
*)
|
||||
warning "Wifi setting for operation system \"$os\" is not supported yet. Skipped."
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
fstab_path="$root_mount_path""etc/fstab" &&
|
||||
fstab_search_string=$(echo "/dev/mmcblk0p1"| sed -e 's/[\/&]/\\&/g') &&
|
||||
fstab_replace_string=$(echo "UUID=$boot_partition_uuid"| sed -e 's/[\/&]/\\&/g') &&
|
||||
info "Seeding UUID to $fstab_path to avoid path conflicts..." &&
|
||||
sed -i "s/$fstab_search_string/$fstab_replace_string/g" "$fstab_path" &&
|
||||
info "Content of $fstab_path:$(cat "$fstab_path")" || error
|
||||
|
||||
info "Running system specific procedures..."
|
||||
if [ "$os" = "retropie" ]
|
||||
then
|
||||
question "Should the roms be copied to the system?(y/N)" && read -r copy_roms
|
||||
if [ "$copy_roms" == "y" ]
|
||||
then
|
||||
target_roms_path="$target_user_home_folder_path""/RetroPie/roms/" &&
|
||||
source_roms_path="$origin_user_home""Games/roms/" &&
|
||||
info "Copy roms from $source_roms_path to $target_roms_path..." &&
|
||||
cp -v "$source_roms_path" "$target_roms_path" &&
|
||||
chown -vR 1000 "$target_roms_path" || error
|
||||
fi
|
||||
question "Should the RetroFlag specific procedures be executed?(y/N)" && read -r setup_retroflag
|
||||
if [ "$setup_retroflag" == "y" ]
|
||||
then
|
||||
info "Executing RetroFlag specific procedures..." &&
|
||||
(
|
||||
echo 'wget -O - "https://raw.githubusercontent.com/RetroFlag/retroflag-picase/master/install_gpi.sh" | bash'
|
||||
) | chroot "$root_mount_path" /bin/bash || error
|
||||
fi
|
||||
fi
|
||||
info "Define target paths..." &&
|
||||
target_home_path="$root_mount_path""home/" &&
|
||||
target_username=$(ls "$target_home_path") &&
|
||||
target_user_home_folder_path="$target_home_path$target_username/" &&
|
||||
target_user_ssh_folder_path="$target_user_home_folder_path"".ssh/" &&
|
||||
target_authorized_keys="$target_user_ssh_folder_path""authorized_keys" &&
|
||||
question "Should the ssh-key be copied to the image?(y/N)" && read -r copy_ssh_key || error
|
||||
if [ "$copy_ssh_key" == "y" ]
|
||||
then
|
||||
info "Copy ssh key to target..." &&
|
||||
origin_user_rsa_pub="$origin_user_home"".ssh/id_rsa.pub" || error
|
||||
if [ -f "$origin_user_rsa_pub" ]
|
||||
then
|
||||
mkdir -v "$target_user_ssh_folder_path" || warning "Folder \"$target_user_ssh_folder_path\" exists. Can't be created."
|
||||
cat "$origin_user_rsa_pub" > "$target_authorized_keys" &&
|
||||
target_authorized_keys_content=$(cat "$target_authorized_keys") &&
|
||||
info "$target_authorized_keys contains the following: $target_authorized_keys_content" &&
|
||||
chown -vR 1000 "$target_user_ssh_folder_path" &&
|
||||
chmod -v 700 "$target_user_ssh_folder_path" &&
|
||||
chmod -v 600 "$target_authorized_keys" || error
|
||||
else
|
||||
warning "The ssh key \"$origin_user_rsa_pub\" can't be copied to \"$target_authorized_keys\" because it doesn't exist."
|
||||
fi
|
||||
else
|
||||
info "Skipped SSH-key copying.."
|
||||
fi
|
||||
|
||||
info "Start chroot procedures..."
|
||||
|
||||
mount_chroot_binds
|
||||
|
||||
copy_qemu
|
||||
|
||||
copy_resolve_conf
|
||||
|
||||
question "Should the password of the standart user \"$target_username\" be changed?(y/N)" && read -r change_password
|
||||
if [ "$change_password" == "y" ]
|
||||
then
|
||||
info "Changing passwords on target system..."
|
||||
question "Type in new password: " && read -r password_1
|
||||
question "Repeat new password\"$target_username\"" && read -r password_2
|
||||
if [ "$password_1" = "$password_2" ]
|
||||
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
|
||||
info "Skipped password change..."
|
||||
fi
|
||||
|
||||
hostname_path="$root_mount_path""etc/hostname"
|
||||
question "Should the hostname be changed?(y/N)" && read -r change_hostname
|
||||
if [ "$change_hostname" == "y" ]
|
||||
then
|
||||
question "Type in the hostname:" && read -r target_hostname;
|
||||
echo "$target_hostname" > "$hostname_path" || error
|
||||
else
|
||||
target_hostname=$(cat "$hostname_path")
|
||||
info "Skipped hostname change..."
|
||||
fi
|
||||
info "Used hostname is: $target_hostname"
|
||||
|
||||
case "$os" in
|
||||
"arch"|"manjaro")
|
||||
info "Populating keys..." &&
|
||||
(
|
||||
echo "yes | pacman-key --init"
|
||||
echo "yes | pacman-key --populate archlinuxarm"
|
||||
) | chroot "$root_mount_path" /bin/bash || error
|
||||
;;
|
||||
esac
|
||||
|
||||
question "Should the system be updated?(y/N)" && read -r update_system
|
||||
if [ "$update_system" == "y" ]
|
||||
then
|
||||
info "Updating system..."
|
||||
case "$os" in
|
||||
"arch"|"manjaro")
|
||||
echo "pacman --noconfirm -Syyu" | chroot "$root_mount_path" /bin/bash || error
|
||||
;;
|
||||
"moode"|"retropie")
|
||||
(
|
||||
echo "yes | apt update"
|
||||
echo "yes | apt upgrade"
|
||||
) | chroot "$root_mount_path" /bin/bash || error
|
||||
;;
|
||||
*)
|
||||
warning "System update for operation system \"$os\" is not supported yet. Skipped."
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
info "Installing software for filesystem $root_filesystem..."
|
||||
if [ "$root_filesystem" == "btrfs" ]
|
||||
then
|
||||
install "btrfs-progs"
|
||||
else
|
||||
info "Skipped."
|
||||
fi
|
||||
|
||||
if [ "$encrypt_system" == "y" ]
|
||||
then
|
||||
# Adapted this instruction for setting up encrypted systems @see https://gist.github.com/gea0/4fc2be0cb7a74d0e7cc4322aed710d38
|
||||
info "Setup encryption..." &&
|
||||
|
||||
info "Installing neccessary software..." &&
|
||||
install "$(get_packages "server/luks")" &&
|
||||
|
||||
dropbear_root_key_path="$root_mount_path""etc/dropbear/root_key" &&
|
||||
info "Adding $target_authorized_keys to dropbear..." &&
|
||||
cp -v "$target_authorized_keys" "$dropbear_root_key_path" &&
|
||||
|
||||
#Concerning mkinitcpio warning @see https://gist.github.com/imrvelj/c65cd5ca7f5505a65e59204f5a3f7a6d
|
||||
mkinitcpio_path="$root_mount_path""etc/mkinitcpio.conf" &&
|
||||
info "Configuring $mkinitcpio_path..." &&
|
||||
mkinitcpio_search_modules="MODULES=()" &&
|
||||
mkinitcpio_replace_modules="MODULES=(g_cdc usb_f_acm usb_f_ecm smsc95xx g_ether)" &&
|
||||
mkinitcpio_search_binaries="BINARIES=()" &&
|
||||
mkinitcpio_replace_binaries=$(echo "BINARIES=(/usr/lib/libgcc_s.so.1)"| sed -e 's/[\/&]/\\&/g') &&
|
||||
mkinitcpio_encrypt_hooks="sleep netconf dropbear encryptssh" &&
|
||||
mkinitcpio_search_hooks="HOOKS=(base udev autodetect modconf block filesystems keyboard fsck)" &&
|
||||
mkinitcpio_replace_hooks="HOOKS=(base udev autodetect modconf block $mkinitcpio_encrypt_hooks filesystems keyboard fsck)" &&
|
||||
sed -i "s/$mkinitcpio_search_modules/$mkinitcpio_replace_modules/g" "$mkinitcpio_path" &&
|
||||
sed -i "s/$mkinitcpio_search_binaries/$mkinitcpio_replace_binaries/g" "$mkinitcpio_path" &&
|
||||
sed -i "s/$mkinitcpio_search_hooks/$mkinitcpio_replace_hooks/g" "$mkinitcpio_path" &&
|
||||
info "Content of $mkinitcpio_path:$(cat "$mkinitcpio_path")" &&
|
||||
info "Generating mkinitcpio..." &&
|
||||
echo "mkinitcpio -vP" | chroot "$root_mount_path" /bin/bash &&
|
||||
|
||||
fstab_insert_line="UUID=$root_partition_uuid / $root_filesystem defaults,noatime 0 1" &&
|
||||
info "Configuring $fstab_path..." || error
|
||||
if grep -q "$fstab_insert_line" "$fstab_path"
|
||||
then
|
||||
warning "$fstab_path contains allready $fstab_insert_line - Skipped."
|
||||
else
|
||||
echo "$fstab_insert_line" >> "$fstab_path" || error
|
||||
fi
|
||||
info "Content of $fstab_path:$(cat "$fstab_path")" &&
|
||||
|
||||
crypttab_path="$root_mount_path""etc/crypttab" &&
|
||||
crypttab_insert_line="$root_mapper_name UUID=$root_partition_uuid none luks" &&
|
||||
info "Configuring $crypttab_path..." || error
|
||||
if grep -q "$crypttab_insert_line" "$crypttab_path"
|
||||
then
|
||||
warning "$crypttab_path contains allready $crypttab_insert_line - Skipped."
|
||||
else
|
||||
echo "$crypttab_insert_line" >> "$crypttab_path" || error
|
||||
fi
|
||||
info "Content of $crypttab_path:$(cat "$crypttab_path")" &&
|
||||
|
||||
boot_txt_path="$boot_mount_path""boot.txt" &&
|
||||
cryptdevice_configuration="cryptdevice=UUID=$root_partition_uuid:$root_mapper_name root=$root_mapper_path" || error
|
||||
if [ -f "$boot_txt_path" ];
|
||||
then
|
||||
info "Configuring $boot_txt_path..." &&
|
||||
boot_txt_delete_line=$(echo "part uuid \${devtype} \${devnum}:2 uuid" | sed -e 's/[]\/$*.^[]/\\&/g') &&
|
||||
boot_txt_setenv_origin=$(echo "setenv bootargs console=ttyS1,115200 console=tty0 root=PARTUUID=\${uuid} rw rootwait smsc95xx.macaddr=\"\${usbethaddr}\"" | sed -e 's/[]\/$*.^[]/\\&/g') &&
|
||||
boot_txt_setenv_replace=$(echo "setenv bootargs console=ttyS1,115200 console=tty0 ip=::::$target_hostname:eth0:dhcp $cryptdevice_configuration rw rootwait smsc95xx.macaddr=\"\${usbethaddr}\""| sed -e 's/[\/&]/\\&/g') &&
|
||||
sed -i "s/$boot_txt_delete_line//g" "$boot_txt_path" &&
|
||||
sed -i "s/$boot_txt_setenv_origin/$boot_txt_setenv_replace/g" "$boot_txt_path" &&
|
||||
info "Content of $boot_txt_path:$(cat "$boot_txt_path")" &&
|
||||
info "Generating..." &&
|
||||
echo "cd /boot/ && ./mkscr || exit 1" | chroot "$root_mount_path" /bin/bash || error
|
||||
else
|
||||
cmdline_txt_path="$boot_mount_path""cmdline.txt" &&
|
||||
info "Configuring $cmdline_txt_path..." &&
|
||||
cmdline_search_string=$(echo "root=/dev/mmcblk0p2" | sed -e 's/[\/&]/\\&/g') &&
|
||||
cmdline_replace_string=$(echo "$cryptdevice_configuration rootfstype=$root_filesystem"| sed -e 's/[\/&]/\\&/g') &&
|
||||
sed -i "s/$cmdline_search_string/$cmdline_replace_string/g" "$cmdline_txt_path" &&
|
||||
info "Content of $cmdline_txt_path:$(cat "$cmdline_txt_path")" || error
|
||||
fi
|
||||
fi
|
||||
|
||||
question "Do you want to setup Wifi on the device?(y/N)" && read -r setup_wifi
|
||||
if [ "$setup_wifi" = "y" ]
|
||||
then
|
||||
question "Please type in the ssid:" && read -r ssid
|
||||
question "Please type in the psk:" && read -r psk
|
||||
case "$os" in
|
||||
"retropie")
|
||||
wifi_file="$boot_mount_path""wifikeyfile.txt" &&
|
||||
echo "ssid=\"$ssid\"" > "$wifi_file" &&
|
||||
echo "psk=\"$psk\"" >> "$wifi_file" || error
|
||||
;;
|
||||
*)
|
||||
warning "Wifi setting for operation system \"$os\" is not supported yet. Skipped."
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
info "Running system specific procedures..."
|
||||
if [ "$os" = "retropie" ]
|
||||
then
|
||||
question "Should the roms be copied to the system?(y/N)" && read -r copy_roms
|
||||
if [ "$copy_roms" == "y" ]
|
||||
then
|
||||
target_roms_path="$target_user_home_folder_path""/RetroPie/roms/" &&
|
||||
source_roms_path="$origin_user_home""Games/roms/" &&
|
||||
info "Copy roms from $source_roms_path to $target_roms_path..." &&
|
||||
cp -v "$source_roms_path" "$target_roms_path" &&
|
||||
chown -vR 1000 "$target_roms_path" || error
|
||||
fi
|
||||
question "Should the RetroFlag specific procedures be executed?(y/N)" && read -r setup_retroflag
|
||||
if [ "$setup_retroflag" == "y" ]
|
||||
then
|
||||
info "Executing RetroFlag specific procedures..." &&
|
||||
(
|
||||
echo 'wget -O - "https://raw.githubusercontent.com/RetroFlag/retroflag-picase/master/install_gpi.sh" | bash'
|
||||
) | chroot "$root_mount_path" /bin/bash || error
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
destructor
|
||||
success "Setup successfull :)" && exit 0
|
||||
|
Loading…
Reference in New Issue
Block a user