From 7fb733a0a8db0540572493e45897f07f36fbf8cb Mon Sep 17 00:00:00 2001 From: "Kevin Veen-Birkenbach [aka. Frantz]" Date: Thu, 21 May 2020 19:12:45 +0200 Subject: [PATCH 01/36] Added caffeine. Needs to be optimized in the future --- scripts/client/setup.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/client/setup.sh b/scripts/client/setup.sh index 6c663e3..608f840 100644 --- a/scripts/client/setup.sh +++ b/scripts/client/setup.sh @@ -178,6 +178,7 @@ if [ "$DESKTOP_SESSION" == "gnome" ]; then info "Install GNOME extensions..." && install_gnome_extension "nasa_apod@elinvention.ovh" "https://github.com/Elinvention/gnome-shell-extension-nasa-apod.git" install_gnome_extension "dash-to-panel@jderose9.github.com" "https://github.com/home-sweet-gnome/dash-to-panel" + install_gnome_extension "caffeine@patapon.info" "https://github.com/eonpatapon/gnome-shell-extension-caffeine.git" info "Deactivating \"Dash to Dock\"..." && gnome-extensions disable dash-to-dock@micxgx.gmail.com || error From 49f5bddbea4155819cc6436e19d4a3152f4588b0 Mon Sep 17 00:00:00 2001 From: "Kevin Veen-Birkenbach [aka. Frantz]" Date: Thu, 21 May 2020 19:22:14 +0200 Subject: [PATCH 02/36] Optimized chroot procedures --- README.md | 12 ++++++------ scripts/image/base.sh | 14 +++++++++++++- scripts/image/chroot.sh | 24 ++++-------------------- scripts/image/setup.sh | 14 +++++++++----- 4 files changed, 32 insertions(+), 32 deletions(-) diff --git a/README.md b/README.md index 6d67b99..cfec90c 100644 --- a/README.md +++ b/README.md @@ -84,15 +84,15 @@ To pase the configuration to the program use this syntax: ```bash ( echo "$USER" # | The username - echo "sdX" # | The device - echo "64_bit" # | The architecture type; arm or 64_bit - echo "manjaro" # | The operation system - echo "gnome" # | The version + echo "mmcblk1" # | The device + echo "arm" # | The architecture type; arm or 64_bit + echo "arch" # | The operation system + echo "3" # | The version #echo "n" # ├── If arch: Should a encrypted setup be used? (y/n) echo "n" # | Should the image download be forced?(y/n) - echo "y" # | Should the image be transfered to $device_path?(y/n) + echo "n" # | Should the image be transfered to $device_path?(y/n) echo "n" # ├── Overwrite device before copying? (y/n) - echo "n" # | Should the ssh-key be copied to the image?(y/N) + echo "n" # | Should the password be changed?(y/N) #echo "test12345" # ├── The user password_1 #echo "test12345" # ├── The user password_2 echo "n" # | Should the ssh-key be copied to the image?(y/N) diff --git a/scripts/image/base.sh b/scripts/image/base.sh index f3be809..fede976 100644 --- a/scripts/image/base.sh +++ b/scripts/image/base.sh @@ -50,7 +50,7 @@ mount_partitions(){ error } -mount_binds(){ +mount_chroot_binds(){ info "Mount chroot environments..." && chroot_sys_mount_path="$root_mount_path""sys/" && chroot_proc_mount_path="$root_mount_path""proc/" && @@ -63,3 +63,15 @@ mount_binds(){ mount --bind /dev/pts "$chroot_dev_pts_mount_path" || error } + +copy_qemu(){ + info "Copy qemu binary..." && + cp -v /usr/bin/qemu-arm-static "$root_mount_path""usr/bin/" || + error +} + +copy_resolve_conf(){ + info "Copy resolve.conf..." && + cp -v /etc/resolv.conf "$root_mount_path""etc/" || + warning "Failed. Propably there is no internet connection available." +} diff --git a/scripts/image/chroot.sh b/scripts/image/chroot.sh index 8a4e9ff..f0c83a1 100644 --- a/scripts/image/chroot.sh +++ b/scripts/image/chroot.sh @@ -16,32 +16,16 @@ set_partition_paths mount_partitions -mount_binds +mount_chroot_binds -info "ld.so.preload fix" && -sed -i 's/^/#CHROOT /g' "$root_mount_path""etc/ld.so.preload" || -warning "Failed." +copy_qemu -info "Copy qemu binary..." && -cp -v /usr/bin/qemu-arm-static "$root_mount_path""usr/bin/" || -error +copy_resolve_conf -info "Copy resolve.conf..." -cp -v /etc/resolv.conf "$root_mount_path""etc/" && -warning "Failed. Propably there is no internet connection available." - -info "You will be transferred to the bash shell now." && -info "Issue 'exit' when you are done." && -info "Issue 'su pi' if you need to work as the user pi." && -info "chroot to raspbian" && +info "Bash shell starts..." && chroot "$root_mount_path" /bin/bash || error -info "Clean up" && -info "revert ld.so.preload fix" && -sed -i 's/^#CHROOT //g' "$root_mount_path""etc/ld.so.preload" || -warning "Failed." - info "unmount everything" && umount "$root_mount_path"/{dev/pts,dev,sys,proc,boot,} || error diff --git a/scripts/image/setup.sh b/scripts/image/setup.sh index babc033..6cccc9a 100644 --- a/scripts/image/setup.sh +++ b/scripts/image/setup.sh @@ -10,7 +10,6 @@ info "Setupscript for images started..." info "Define functions..." destructor(){ info "Cleaning up..." - sed -i 's/^#CHROOT //g' "$root_mount_path""etc/ld.so.preload" || warning "sed failed." umount -v "$chroot_dev_pts_mount_path" || warning "Umounting $chroot_dev_pts_mount_path failed!" umount -v "$chroot_dev_mount_path" || warning "Umounting $chroot_dev_mount_path failed!" umount -v "$chroot_proc_mount_path" || warning "Umounting $chroot_proc_mount_path failed!" @@ -110,9 +109,12 @@ case "$os" in "1") imagename="ArchLinuxARM-rpi-latest.tar.gz" ;; - "2" | "3") + "2") imagename="ArchLinuxARM-rpi-2-latest.tar.gz" ;; + "3") + imagename="ArchLinuxARM-rpi-3-latest.tar.gz" + ;; "4") imagename="ArchLinuxARM-rpi-4-latest.tar.gz" ;; @@ -314,12 +316,14 @@ if [ "$copy_ssh_key" == "y" ] else info "Skipped SSH-key copying.." fi + info "Start chroot procedures..." -mount_binds +mount_chroot_binds -sed -i 's/^/#CHROOT /g' "$root_mount_path""etc/ld.so.preload" || warning "sed failed." -cp -v /usr/bin/qemu-arm-static "$root_mount_path""/usr/bin/" || error "Copy qemu-arm-static failed. The following packages are neccessary: qemu qemu-user-static binfmt-support." +copy_qemu + +copy_resolve_conf question "Should the image password of the standart user \"$target_username\" be changed?(y/N)" && read -r change_password if [ "$change_password" == "y" ] From 16d16387f27b448d6d64d23f565ef75e74906c8a Mon Sep 17 00:00:00 2001 From: "Kevin Veen-Birkenbach [aka. Frantz]" Date: Thu, 21 May 2020 19:42:29 +0200 Subject: [PATCH 03/36] Optimized chroot --- README.md | 1 + scripts/image/chroot.sh | 10 +++++++--- scripts/image/setup.sh | 15 +++++++++++---- 3 files changed, 19 insertions(+), 7 deletions(-) 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 From d6bb5a2d18a56d50738522225459ee57dbc404c3 Mon Sep 17 00:00:00 2001 From: "Kevin Veen-Birkenbach [aka. Frantz]" Date: Thu, 21 May 2020 20:01:32 +0200 Subject: [PATCH 04/36] Optimized upodate process --- README.md | 2 +- scripts/image/setup.sh | 13 ++++++------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 85e5d30..3e605e4 100644 --- a/README.md +++ b/README.md @@ -91,7 +91,7 @@ To pase the configuration to the program use this syntax: #echo "n" # ├── If arch: Should a encrypted setup be used? (y/n) echo "n" # | Should the image download be forced?(y/n) echo "n" # | Should the image be transfered to $device_path?(y/n) - echo "n" # ├── Overwrite device before copying? (y/n) + #echo "n" # ├── Overwrite device before copying? (y/n) echo "n" # | Should the password be changed?(y/N) #echo "test12345" # ├── The user password_1 #echo "test12345" # ├── The user password_2 diff --git a/scripts/image/setup.sh b/scripts/image/setup.sh index 203bea5..5f22062 100644 --- a/scripts/image/setup.sh +++ b/scripts/image/setup.sh @@ -342,7 +342,7 @@ if [ "$change_password" == "y" ] echo '$password_1' echo '$password_1' ) | passwd" - ) | chroot "$root_mount_path" /bin/bash || error "Password change failed." + ) | chroot "$root_mount_path" /bin/bash || error else error "Passwords didn't match." fi @@ -354,20 +354,22 @@ question "Should the hostname be changed?(y/N)" && read -r change_hostname if [ "$change_hostname" == "y" ] then question "Type in the hostname:" && read -r hostname; - echo "$hostname" > "$root_mount_path""etc/hostname" || error "Changing hostname failed." + echo "$hostname" > "$root_mount_path""etc/hostname" || error else info "Skipped hostname change..." fi -question "Should the image system be updated?(y/N)" && read -r update_system +question "Should the system be updated?(y/N)" && read -r update_system if [ "$update_system" == "y" ] then + info "Updating system..." && ( 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." + ) | chroot "$root_mount_path" /bin/bash || error fi + # question "Do you want to copy all Wifi passwords to the device?(y/n)" && read -r copy_wifi # if [ "$copy_wifi" = "y" ] # then @@ -376,8 +378,5 @@ fi # rsync -av "$origin_wifi_config_path" "$target_wifi_config_path" # fi -info "The first level folder structure on $root_mount_path is:" && tree -laL 1 "$root_mount_path" -info "The first level folder structure on $boot_mount_path is:" && tree -laL 1 "$boot_mount_path" - destructor success "Setup successfull :)" && exit 0 From 19bd0979b3dfd5b498e70ca0da170aae028b6b9a Mon Sep 17 00:00:00 2001 From: "Kevin Veen-Birkenbach [aka. Frantz]" Date: Mon, 25 May 2020 13:40:03 +0200 Subject: [PATCH 05/36] Continued implementation of encryption procedures for pi --- configuration/packages/server/luks.txt | 10 ++++++++++ scripts/base.sh | 10 ++++++++++ scripts/client/setup.sh | 7 ------- scripts/image/setup.sh | 21 +++++++++++++++++++++ 4 files changed, 41 insertions(+), 7 deletions(-) create mode 100644 configuration/packages/server/luks.txt diff --git a/configuration/packages/server/luks.txt b/configuration/packages/server/luks.txt new file mode 100644 index 0000000..238cb70 --- /dev/null +++ b/configuration/packages/server/luks.txt @@ -0,0 +1,10 @@ +# Packages to install LUKS on servers +sudo +git +rsync +base-devel +uboot-tools +dropbear +mkinitcpio-utils +mkinitcpio-netconf +mkinitcpio-dropbear diff --git a/scripts/base.sh b/scripts/base.sh index 6409b79..4d69e6f 100644 --- a/scripts/base.sh +++ b/scripts/base.sh @@ -93,6 +93,16 @@ overwritte_device_with_zeros(){ fi } +get_packages(){ + for package_collection in "$@" + do + package_collection_path="$PACKAGE_PATH""$package_collection.txt" && + info "Loading package collection from $package_collection_path..." && + echo "$(sed -e "/^#/d" -e "s/#.*//" "$package_collection_path" | tr '\n' ' ')" || + error + done +} + HEADER(){ echo echo "${COLOR_YELLOW}The" diff --git a/scripts/client/setup.sh b/scripts/client/setup.sh index 608f840..4c568c1 100644 --- a/scripts/client/setup.sh +++ b/scripts/client/setup.sh @@ -6,13 +6,6 @@ # shellcheck disable=SC2086 # Deactivating escaping warning, because it's wrong concerning pacman_packages source "$(dirname "$(readlink -f "${0}")")/../base.sh" || (echo "Loading base.sh failed." && exit 1) -get_packages(){ - for package_collection in "$@" - do - echo "$(sed -e "/^#/d" -e "s/#.*//" "$PACKAGE_PATH""$package_collection.txt" | tr '\n' ' ')" || error "Loading package wasn't possible." - done -} - install_yay_packages_if_needed(){ info "Checking yay packages [ $1 ]..." for package in $1; do diff --git a/scripts/image/setup.sh b/scripts/image/setup.sh index 5f22062..4d0a2cb 100644 --- a/scripts/image/setup.sh +++ b/scripts/image/setup.sh @@ -370,6 +370,27 @@ if [ "$update_system" == "y" ] ) | chroot "$root_mount_path" /bin/bash || error fi +question "Should the system be encrypted?(y/N)" && read -r encrypt_system +if [ "$encrypt_system" == "y" ] + then + # @see https://gist.github.com/gea0/4fc2be0cb7a74d0e7cc4322aed710d38 + search_hooks="HOOKS=(base udev autodetect modconf block filesystems keyboard fsck)" + replace_hooks="HOOKS=(base udev autodetect modconf block sleep netconf dropbear encryptssh filesystems keyboard fsck)" + mkinitcpio_path="/etc/mkinitcpio.conf" + mkinitcpio_rescue_path="$mkinitcpio_path.$(date +%s).rescue" + search_modules="MODULES=()" + replace_modules="MODULES=(g_cdc usb_f_acm usb_f_ecm smsc95xx g_ether)" + info "Setup encryption..." && + ( + echo "yes | pacman -S --needed $(get_packages "server/luks")" + echo "cp -v /home/$target_username/.ssh/authorized_keys /etc/dropbear/root_key" + echo "cp -v $mkinitcpio_path $mkinitcpio_rescue_path" + echo "sed -i 's/$search_modules/$replace_modules/g' $mkinitcpio_path" + echo "sed -i 's/$search_hooks/$replace_hooks/g' $mkinitcpio_path" + echo "mkinitcpio -P" + ) | chroot "$root_mount_path" /bin/bash || error +fi + # question "Do you want to copy all Wifi passwords to the device?(y/n)" && read -r copy_wifi # if [ "$copy_wifi" = "y" ] # then From 0feab7bce351282c0cfbb5340bd8979fa7aca775 Mon Sep 17 00:00:00 2001 From: "Kevin Veen-Birkenbach [aka. Frantz]" Date: Mon, 25 May 2020 14:18:34 +0200 Subject: [PATCH 06/36] Added draft for retroflag --- scripts/image/setup.sh | 49 ++++++++++++++++++++++++++++++++++++------ 1 file changed, 42 insertions(+), 7 deletions(-) diff --git a/scripts/image/setup.sh b/scripts/image/setup.sh index 4d0a2cb..3df50b9 100644 --- a/scripts/image/setup.sh +++ b/scripts/image/setup.sh @@ -325,7 +325,7 @@ copy_qemu copy_resolve_conf -question "Should the image password of the standart user \"$target_username\" be changed?(y/N)" && read -r change_password +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..." @@ -362,12 +362,25 @@ fi question "Should the system be updated?(y/N)" && read -r update_system if [ "$update_system" == "y" ] then - info "Updating system..." && - ( - echo "yes | pacman-key --init" - echo "yes | pacman-key --populate archlinuxarm" - echo "yes | pacman -Syyu" - ) | chroot "$root_mount_path" /bin/bash || error + info "Updating system..." + case "$os" in + "arch"|"manjaro") + ( + echo "yes | pacman-key --init" + echo "yes | pacman-key --populate archlinuxarm" + echo "yes | pacman -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 question "Should the system be encrypted?(y/N)" && read -r encrypt_system @@ -399,5 +412,27 @@ fi # rsync -av "$origin_wifi_config_path" "$target_wifi_config_path" # fi +info "Running system specific procedures..." +if [ "$os" = "retropie" ] + then + question "Should the roms be copied to the system?" && 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?" && 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 + destructor success "Setup successfull :)" && exit 0 From 57b8fe2d6904f59ef78491d38da92f68756af27d Mon Sep 17 00:00:00 2001 From: "Kevin Veen-Birkenbach [aka. Frantz]" Date: Mon, 25 May 2020 14:46:52 +0200 Subject: [PATCH 07/36] Solved some bugs git push --- scripts/image/setup.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/scripts/image/setup.sh b/scripts/image/setup.sh index 3df50b9..cb3e6b9 100644 --- a/scripts/image/setup.sh +++ b/scripts/image/setup.sh @@ -201,8 +201,8 @@ fi info "Verifying image..." if [[ -v image_checksum ]] then - info "Checking md5 checksum..." && echo "$image_checksum $image_path"| md5sum -c -|| - info "Checking sha1 checksum..." && echo "$image_checksum $image_path"| sha1sum -c -|| + (info "Checking md5 checksum..." && echo "$image_checksum $image_path"| md5sum -c -) || + (info "Checking sha1 checksum..." && echo "$image_checksum $image_path"| sha1sum -c -) || error "Verification failed. HINT: Force the download of the image." else warning "Verification is not possible. No checksum is defined." @@ -212,7 +212,7 @@ make_mount_folders set_partition_paths -question "Should the image be transfered to $device_path?(y/n)" && read -r transfer_image +question "Should the image be transfered to $device_path?(y/N)" && read -r transfer_image if [ "$transfer_image" = "y" ] then @@ -302,7 +302,7 @@ if [ "$copy_ssh_key" == "y" ] origin_user_rsa_pub="$origin_user_home"".ssh/id_rsa.pub"; if [ -f "$origin_user_rsa_pub" ] then - mkdir -v "$target_user_ssh_folder_path" && + 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" && @@ -415,7 +415,7 @@ fi info "Running system specific procedures..." if [ "$os" = "retropie" ] then - question "Should the roms be copied to the system?" && read -r copy_roms + 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/" && @@ -424,7 +424,7 @@ if [ "$os" = "retropie" ] cp -v "$source_roms_path" "$target_roms_path" && chown -vR 1000 "$target_roms_path" || error fi - question "Should the RetroFlag specific procedures be executed?" && read -r setup_retroflag + question "Should the RetroFlag specific procedures be executed?(y/N)" && read -r setup_retroflag if [ "$setup_retroflag" == "y" ] then info "Executing RetroFlag specific procedures..." && From f28f8cd11ba5089eb239a118cf77c4cc949d0660 Mon Sep 17 00:00:00 2001 From: "Kevin Veen-Birkenbach [aka. Frantz]" Date: Tue, 26 May 2020 14:07:29 +0200 Subject: [PATCH 08/36] Optimized setup procedure --- scripts/image/setup.sh | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/scripts/image/setup.sh b/scripts/image/setup.sh index cb3e6b9..bbbf0a4 100644 --- a/scripts/image/setup.sh +++ b/scripts/image/setup.sh @@ -404,13 +404,22 @@ if [ "$encrypt_system" == "y" ] ) | chroot "$root_mount_path" /bin/bash || error fi -# question "Do you want to copy all Wifi passwords to the device?(y/n)" && read -r copy_wifi -# if [ "$copy_wifi" = "y" ] -# then -# origin_wifi_config_path="/etc/NetworkManager/system-connections/" -# target_wifi_config_path="$root_mount_path$origin_wifi_config_path" -# rsync -av "$origin_wifi_config_path" "$target_wifi_config_path" -# 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" + ;; + *) + warning "Wifi setting for operation system \"$os\" is not supported yet. Skipped." + ;; + esac +fi info "Running system specific procedures..." if [ "$os" = "retropie" ] From c45520bfb17c26d08a8417e12c11db4d0409d0c4 Mon Sep 17 00:00:00 2001 From: "Kevin Veen-Birkenbach [aka. Frantz]" Date: Tue, 26 May 2020 14:10:13 +0200 Subject: [PATCH 09/36] Added nextcloud client --- configuration/packages/client/pacman/general.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/configuration/packages/client/pacman/general.txt b/configuration/packages/client/pacman/general.txt index 9e6c143..8136726 100644 --- a/configuration/packages/client/pacman/general.txt +++ b/configuration/packages/client/pacman/general.txt @@ -82,3 +82,6 @@ ansible # entertainment software rhythmbox + +# cloud +nextcloud-client From ab61c8941cd55ccecc65f70146273821f004bf59 Mon Sep 17 00:00:00 2001 From: "Kevin Veen-Birkenbach [aka. Frantz]" Date: Mon, 8 Jun 2020 17:45:11 +0200 Subject: [PATCH 10/36] Solved mount bug --- scripts/image/base.sh | 2 +- scripts/image/setup.sh | 14 +++++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/scripts/image/base.sh b/scripts/image/base.sh index fede976..b2aa5b3 100644 --- a/scripts/image/base.sh +++ b/scripts/image/base.sh @@ -56,7 +56,7 @@ mount_chroot_binds(){ chroot_proc_mount_path="$root_mount_path""proc/" && chroot_dev_mount_path="$root_mount_path""dev/" && chroot_dev_pts_mount_path="$root_mount_path""dev/pts" && - mount --bind "$boot_mount_path" "$root_mount_path""/boot" && + mount --bind "$boot_mount_path" "$root_mount_path""boot" && mount --bind /dev "$chroot_dev_mount_path" && mount --bind /sys "$chroot_sys_mount_path" && mount --bind /proc "$chroot_proc_mount_path" && diff --git a/scripts/image/setup.sh b/scripts/image/setup.sh index bbbf0a4..532c797 100644 --- a/scripts/image/setup.sh +++ b/scripts/image/setup.sh @@ -253,7 +253,7 @@ if [ "$transfer_image" = "y" ] error info "Boot files will be transfered to device..." && - mv -v "$root_mount_path/boot/"* "$boot_mount_path" || + mv -v "$root_mount_path""boot/"* "$boot_mount_path" || error elif [ "${image_path: -4}" = ".zip" ] then @@ -281,11 +281,15 @@ if [ "$transfer_image" = "y" ] fi info "Start regular mounting procedure..." -if mount | grep -q "$boot_mount_path" && mount | grep -q "$root_mount_path" +if ! mount | grep -q "$boot_mount_path" then - info "Everything allready mounted. Skipping..." - else - mount_partitions + info "$boot_mount_path is allready mounted..." + if ! mount | grep -q "$root_mount_path" + then + info "$root_mount_path is allready mounted..." + else + mount_partitions + fi fi info "Define target paths..." From 913f7361c926a24e89edef03d6cfc784c5369595 Mon Sep 17 00:00:00 2001 From: "Kevin Veen-Birkenbach [aka. Frantz]" Date: Thu, 11 Jun 2020 09:43:54 +0200 Subject: [PATCH 11/36] Removed systemd-guest-user --- configuration/packages/client/yay/general.txt | 2 -- 1 file changed, 2 deletions(-) diff --git a/configuration/packages/client/yay/general.txt b/configuration/packages/client/yay/general.txt index 92f50fc..38c14c3 100644 --- a/configuration/packages/client/yay/general.txt +++ b/configuration/packages/client/yay/general.txt @@ -8,5 +8,3 @@ libpurple-carbons eclipse-java # language server ccls -# guest user support -systemd-guest-user From a53ae1e762a2765c9b22dc9947bf65eb234cd8a6 Mon Sep 17 00:00:00 2001 From: "Kevin Veen-Birkenbach [aka. Frantz]" Date: Thu, 11 Jun 2020 10:02:57 +0200 Subject: [PATCH 12/36] Deactivated mounting --- scripts/image/chroot.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/image/chroot.sh b/scripts/image/chroot.sh index 19ced40..22515bc 100644 --- a/scripts/image/chroot.sh +++ b/scripts/image/chroot.sh @@ -6,7 +6,7 @@ source "$(dirname "$(readlink -f "${0}")")/base.sh" || (echo "Loading base.sh fa destructor(){ info "Unmount everything" && - umount "$root_mount_path"/{dev/pts,dev,sys,proc,boot,} $boot_mount_path|| + umount "$root_mount_path"{dev/pts,dev,sys,proc,boot,} $boot_mount_path|| warning "Failed." } From e8ffc4d756e8c0dc1b5ca37e5f0dfa857883ccd4 Mon Sep 17 00:00:00 2001 From: "Kevin Veen-Birkenbach [aka. Frantz]" Date: Thu, 11 Jun 2020 10:13:54 +0200 Subject: [PATCH 13/36] Solved internet connection bug --- scripts/image/base.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/image/base.sh b/scripts/image/base.sh index b2aa5b3..534dfd7 100644 --- a/scripts/image/base.sh +++ b/scripts/image/base.sh @@ -72,6 +72,6 @@ copy_qemu(){ copy_resolve_conf(){ info "Copy resolve.conf..." && - cp -v /etc/resolv.conf "$root_mount_path""etc/" || + cp --remove-destination -v /etc/resolv.conf "$root_mount_path""etc/" || warning "Failed. Propably there is no internet connection available." } From aa2eb62e775e7401891fea5adcc89f55b43111f0 Mon Sep 17 00:00:00 2001 From: "Kevin Veen-Birkenbach [aka. Frantz]" Date: Thu, 11 Jun 2020 11:41:51 +0200 Subject: [PATCH 14/36] Optimized umount procedures --- scripts/image/base.sh | 12 ++++++++++++ scripts/image/chroot.sh | 4 +--- scripts/image/setup.sh | 8 +------- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/scripts/image/base.sh b/scripts/image/base.sh index 534dfd7..1d82fd5 100644 --- a/scripts/image/base.sh +++ b/scripts/image/base.sh @@ -50,6 +50,18 @@ mount_partitions(){ error } +umount_everything(){ + info "Unmounting everything..." && + (umount -lv "$chroot_dev_pts_mount_path" || warning "Umounting $chroot_dev_pts_mount_path failed!") && + (umount -lv "$chroot_dev_mount_path" || warning "Umounting $chroot_dev_mount_path failed!" ) && + (umount -v "$chroot_proc_mount_path" || warning "Umounting $chroot_proc_mount_path failed!" ) && + (umount -v "$chroot_sys_mount_path" || warning "Umounting $chroot_sys_mount_path failed!") && + (umount -v "$root_mount_path""boot/" || warning "Umounting $root_mount_path""boot/ failed!") && + (umount -v "$root_mount_path" || warning "Umounting $root_mount_path failed!") && + (umount -v "$boot_mount_path" || warning "Umounting $boot_mount_path failed!") || + warning "Failed." +} + mount_chroot_binds(){ info "Mount chroot environments..." && chroot_sys_mount_path="$root_mount_path""sys/" && diff --git a/scripts/image/chroot.sh b/scripts/image/chroot.sh index 22515bc..b751df8 100644 --- a/scripts/image/chroot.sh +++ b/scripts/image/chroot.sh @@ -5,9 +5,7 @@ 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." + umount_everything } info "Starting chroot..." diff --git a/scripts/image/setup.sh b/scripts/image/setup.sh index 532c797..6d7c31b 100644 --- a/scripts/image/setup.sh +++ b/scripts/image/setup.sh @@ -10,13 +10,7 @@ info "Setupscript for images started..." info "Define functions..." destructor(){ info "Cleaning up..." - umount -v "$chroot_dev_pts_mount_path" || warning "Umounting $chroot_dev_pts_mount_path failed!" - umount -v "$chroot_dev_mount_path" || warning "Umounting $chroot_dev_mount_path failed!" - umount -v "$chroot_proc_mount_path" || warning "Umounting $chroot_proc_mount_path failed!" - umount -v "$chroot_sys_mount_path" || warning "Umounting $chroot_sys_mount_path failed!" - umount -v "$root_mount_path""boot/" || warning "Umounting $root_mount_path""boot/ failed!" - umount -v "$root_mount_path" || warning "Umounting $root_mount_path failed!" - umount -v "$boot_mount_path" || warning "Umounting $boot_mount_path failed!" + umount_everything rmdir -v "$root_mount_path" || warning "Removing $root_mount_path failed!" rmdir -v "$boot_mount_path" || warning "Removing $boot_mount_path failed!" rmdir -v "$working_folder_path" || warning "Removing $working_folder_path failed!" From a8d099144e4e35593aab162ffeb667a1916ece18 Mon Sep 17 00:00:00 2001 From: "Kevin Veen-Birkenbach [aka. Frantz]" Date: Thu, 11 Jun 2020 12:19:19 +0200 Subject: [PATCH 15/36] Refactored destructor --- scripts/image/base.sh | 22 +++++++++++++--------- scripts/image/chroot.sh | 4 ---- scripts/image/setup.sh | 9 --------- 3 files changed, 13 insertions(+), 22 deletions(-) diff --git a/scripts/image/base.sh b/scripts/image/base.sh index 1d82fd5..8693779 100644 --- a/scripts/image/base.sh +++ b/scripts/image/base.sh @@ -51,15 +51,19 @@ mount_partitions(){ } umount_everything(){ - info "Unmounting everything..." && - (umount -lv "$chroot_dev_pts_mount_path" || warning "Umounting $chroot_dev_pts_mount_path failed!") && - (umount -lv "$chroot_dev_mount_path" || warning "Umounting $chroot_dev_mount_path failed!" ) && - (umount -v "$chroot_proc_mount_path" || warning "Umounting $chroot_proc_mount_path failed!" ) && - (umount -v "$chroot_sys_mount_path" || warning "Umounting $chroot_sys_mount_path failed!") && - (umount -v "$root_mount_path""boot/" || warning "Umounting $root_mount_path""boot/ failed!") && - (umount -v "$root_mount_path" || warning "Umounting $root_mount_path failed!") && - (umount -v "$boot_mount_path" || warning "Umounting $boot_mount_path failed!") || - warning "Failed." + info "Cleaning up..." + info "Unmounting everything..." + umount -lv "$chroot_dev_pts_mount_path" || warning "Umounting $chroot_dev_pts_mount_path failed!" + umount -lv "$chroot_dev_mount_path" || warning "Umounting $chroot_dev_mount_path failed!" + umount -v "$chroot_proc_mount_path" || warning "Umounting $chroot_proc_mount_path failed!" + umount -v "$chroot_sys_mount_path" || warning "Umounting $chroot_sys_mount_path failed!" + umount -v "$root_mount_path""boot/" || warning "Umounting $root_mount_path""boot/ failed!" + umount -v "$root_mount_path" || warning "Umounting $root_mount_path failed!" + umount -v "$boot_mount_path" || warning "Umounting $boot_mount_path failed!" + info "Deleting mount folders..." + rmdir -v "$root_mount_path" || warning "Removing $root_mount_path failed!" + rmdir -v "$boot_mount_path" || warning "Removing $boot_mount_path failed!" + rmdir -v "$working_folder_path" || warning "Removing $working_folder_path failed!" } mount_chroot_binds(){ diff --git a/scripts/image/chroot.sh b/scripts/image/chroot.sh index b751df8..a968ae7 100644 --- a/scripts/image/chroot.sh +++ b/scripts/image/chroot.sh @@ -4,10 +4,6 @@ # shellcheck disable=SC2154 # Deactivate not referenced link source "$(dirname "$(readlink -f "${0}")")/base.sh" || (echo "Loading base.sh failed." && exit 1) -destructor(){ - umount_everything -} - info "Starting chroot..." set_device_path diff --git a/scripts/image/setup.sh b/scripts/image/setup.sh index 6d7c31b..7ee3492 100644 --- a/scripts/image/setup.sh +++ b/scripts/image/setup.sh @@ -7,15 +7,6 @@ source "$(dirname "$(readlink -f "${0}")")/base.sh" || (echo "Loading base.sh fa info "Setupscript for images started..." -info "Define functions..." -destructor(){ - info "Cleaning up..." - umount_everything - rmdir -v "$root_mount_path" || warning "Removing $root_mount_path failed!" - rmdir -v "$boot_mount_path" || warning "Removing $boot_mount_path failed!" - rmdir -v "$working_folder_path" || warning "Removing $working_folder_path failed!" -} - info "Checking if root..." if [ "$(id -u)" != "0" ];then error "This script must be executed as root!" From 09bde4fadf7fcdc316ae81e8f1d8e1f9f4ddcb07 Mon Sep 17 00:00:00 2001 From: "Kevin Veen-Birkenbach [aka. Frantz]" Date: Thu, 11 Jun 2020 14:52:39 +0200 Subject: [PATCH 16/36] Solved mounting bug --- scripts/image/setup.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/image/setup.sh b/scripts/image/setup.sh index 7ee3492..af793ad 100644 --- a/scripts/image/setup.sh +++ b/scripts/image/setup.sh @@ -266,10 +266,11 @@ if [ "$transfer_image" = "y" ] fi info "Start regular mounting procedure..." -if ! mount | grep -q "$boot_mount_path" +if mount | grep -q "$boot_mount_path" then info "$boot_mount_path is allready mounted..." - if ! mount | grep -q "$root_mount_path" + else + if mount | grep -q "$root_mount_path" then info "$root_mount_path is allready mounted..." else From 9922b48547d258b62a1c9f6ffdc0dcbd44fbba6d Mon Sep 17 00:00:00 2001 From: "Kevin Veen-Birkenbach [aka. Frantz]" Date: Thu, 11 Jun 2020 15:09:28 +0200 Subject: [PATCH 17/36] Solved destructor and package load bug --- scripts/base.sh | 2 +- scripts/image/base.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/base.sh b/scripts/base.sh index 4d69e6f..67e15c0 100644 --- a/scripts/base.sh +++ b/scripts/base.sh @@ -97,7 +97,7 @@ get_packages(){ for package_collection in "$@" do package_collection_path="$PACKAGE_PATH""$package_collection.txt" && - info "Loading package collection from $package_collection_path..." && + #info "Loading package collection from $package_collection_path..." && echo "$(sed -e "/^#/d" -e "s/#.*//" "$package_collection_path" | tr '\n' ' ')" || error done diff --git a/scripts/image/base.sh b/scripts/image/base.sh index 8693779..43cb4d5 100644 --- a/scripts/image/base.sh +++ b/scripts/image/base.sh @@ -50,7 +50,7 @@ mount_partitions(){ error } -umount_everything(){ +destructor(){ info "Cleaning up..." info "Unmounting everything..." umount -lv "$chroot_dev_pts_mount_path" || warning "Umounting $chroot_dev_pts_mount_path failed!" From 36620d9fa29e183990f217d09caa49d60b7aaa26 Mon Sep 17 00:00:00 2001 From: "Kevin Veen-Birkenbach [aka. Frantz]" Date: Thu, 11 Jun 2020 15:33:49 +0200 Subject: [PATCH 18/36] Optimized packages --- configuration/packages/general.txt | 1 + configuration/packages/server/luks.txt | 2 -- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/configuration/packages/general.txt b/configuration/packages/general.txt index 7fc5dc4..fa3a8cd 100644 --- a/configuration/packages/general.txt +++ b/configuration/packages/general.txt @@ -3,3 +3,4 @@ nano tree htop git +sudo diff --git a/configuration/packages/server/luks.txt b/configuration/packages/server/luks.txt index 238cb70..2fb8c20 100644 --- a/configuration/packages/server/luks.txt +++ b/configuration/packages/server/luks.txt @@ -1,6 +1,4 @@ # Packages to install LUKS on servers -sudo -git rsync base-devel uboot-tools From b3ac70d45a3ddeb8fd2fa5e870a90fe2550f64b7 Mon Sep 17 00:00:00 2001 From: "Kevin Veen-Birkenbach [aka. Frantz]" Date: Thu, 11 Jun 2020 15:34:08 +0200 Subject: [PATCH 19/36] Deleted unneccessary comment --- scripts/base.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/base.sh b/scripts/base.sh index 67e15c0..aae9d51 100644 --- a/scripts/base.sh +++ b/scripts/base.sh @@ -97,7 +97,6 @@ get_packages(){ for package_collection in "$@" do package_collection_path="$PACKAGE_PATH""$package_collection.txt" && - #info "Loading package collection from $package_collection_path..." && echo "$(sed -e "/^#/d" -e "s/#.*//" "$package_collection_path" | tr '\n' ' ')" || error done From b4774f9b12fd71f05139ba9611989898faa2b4f5 Mon Sep 17 00:00:00 2001 From: "Kevin Veen-Birkenbach [aka. Frantz]" Date: Thu, 11 Jun 2020 15:36:27 +0200 Subject: [PATCH 20/36] Added noconfirm to pacman --- scripts/image/setup.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/image/setup.sh b/scripts/image/setup.sh index af793ad..71b9b2e 100644 --- a/scripts/image/setup.sh +++ b/scripts/image/setup.sh @@ -358,7 +358,7 @@ if [ "$update_system" == "y" ] ( echo "yes | pacman-key --init" echo "yes | pacman-key --populate archlinuxarm" - echo "yes | pacman -Syyu" + echo "pacman --noconfirm -Syyu" ) | chroot "$root_mount_path" /bin/bash || error ;; "moode"|"retropie") @@ -385,7 +385,7 @@ if [ "$encrypt_system" == "y" ] replace_modules="MODULES=(g_cdc usb_f_acm usb_f_ecm smsc95xx g_ether)" info "Setup encryption..." && ( - echo "yes | pacman -S --needed $(get_packages "server/luks")" + echo "pacman --noconfirm -S --needed $(get_packages "server/luks")" echo "cp -v /home/$target_username/.ssh/authorized_keys /etc/dropbear/root_key" echo "cp -v $mkinitcpio_path $mkinitcpio_rescue_path" echo "sed -i 's/$search_modules/$replace_modules/g' $mkinitcpio_path" From 97beb0a9ab5395f09790e13f3a2c2d1e99f45af9 Mon Sep 17 00:00:00 2001 From: "Kevin Veen-Birkenbach [aka. Frantz]" Date: Thu, 11 Jun 2020 16:58:15 +0200 Subject: [PATCH 21/36] Implemented partition creation for encrypted system --- scripts/image/base.sh | 7 +++-- scripts/image/setup.sh | 71 ++++++++++++++++++++++++++++++------------ 2 files changed, 55 insertions(+), 23 deletions(-) diff --git a/scripts/image/base.sh b/scripts/image/base.sh index 43cb4d5..e734fac 100644 --- a/scripts/image/base.sh +++ b/scripts/image/base.sh @@ -22,8 +22,9 @@ echo_partition_name(){ set_partition_paths(){ info "Setting partition paths..." - root_partition_path=$(echo_partition_name "2") boot_partition_path=$(echo_partition_name "1") + root_partition_path=$(echo_partition_name "2") + encrypted_partition_path=$(echo_partition_name "3") } make_mount_folders(){ @@ -44,8 +45,8 @@ make_working_folder(){ mount_partitions(){ info "Mount boot and root partition..." && - mount "$boot_partition_path" "$boot_mount_path" && - mount "$root_partition_path" "$root_mount_path" && + mount -v "$boot_partition_path" "$boot_mount_path" && + mount -v "$root_partition_path" "$root_mount_path" && info "The following mounts refering this setup exist:" && mount | grep "$working_folder_path" || error } diff --git a/scripts/image/setup.sh b/scripts/image/setup.sh index 71b9b2e..5a8b1f7 100644 --- a/scripts/image/setup.sh +++ b/scripts/image/setup.sh @@ -89,6 +89,7 @@ os_does_not_support_raspberry_version_error () { case "$os" in "arch") + question "Should the system be encrypted?(y/N)" && read -r encrypt_system base_download_url="http://os.archlinuxarm.org/os/"; case "$version" in "1") @@ -206,29 +207,60 @@ if [ "$transfer_image" = "y" ] info "Starting image transfer..." if [ "$os" = "arch" ] then - info "Execute fdisk..." - ( echo "o" #Type o. This will clear out any partitions on the drive. - echo "p" #Type p to list partitions. There should be no partitions left - echo "n" #Type n, - echo "p" #then p for primary, - echo "1" #1 for the first partition on the drive, - echo "" #press ENTER to accept the default first sector, - echo "+100M" #then type +100M for the last sector. - echo "t" #Type t, - echo "c" #then c to set the first partition to type W95 FAT32 (LBA). - echo "n" #Type n, - echo "p" #then p for primary, - echo "2" #2 for the second partition on the drive, - echo "" #and then press ENTER twice to accept the default first and last sector. - echo "" - echo "w" #Write the partition table and exit by typing w. - )| fdisk "$device_path" || error "Creating partitions failed. Try to execute this script with the overwritting parameter." + info "Deleting partition tables..." && + wipefs -a "$device_path" || error + if [ "$encrypt_system" == "y" ] + then + info "Creating partitions for encrypted system..." && + ( echo "o" #Type o. This will clear out any partitions on the drive. + echo "p" #Type p to list partitions. There should be no partitions left + echo "n" #Type n, + echo "p" #then p for primary, + echo "1" #1 for the first partition on the drive, + echo "" #press ENTER to accept the default first sector, + echo "+300M" #then type +100M for the last sector. + echo "t" #Type t, + echo "c" #then c to set the first partition to type W95 FAT32 (LBA). + echo "n" #Type n, + echo "p" #then p for primary, + echo "2" #2 for the second partition on the drive, + echo "" #Default start sector + echo "+3G" #Endsector + echo "n" #Type n, + echo "p" #then p for primary, + echo "3" #2 for the second partition on the drive, + echo "" #Default start sector + echo "" #Default end sector + echo "w" #Write the partition table and exit by typing w. + )| fdisk "$device_path" || error + + info "Format encrypted partition..." && + mkfs.ext4 "$encrypted_partition_path" || error + else + info "Creating partitions..." && + ( echo "o" #Type o. This will clear out any partitions on the drive. + echo "p" #Type p to list partitions. There should be no partitions left + echo "n" #Type n, + echo "p" #then p for primary, + echo "1" #1 for the first partition on the drive, + echo "" #Default start sector + echo "+100M" #then type +100M for the last sector. + echo "t" #Type t, + echo "c" #then c to set the first partition to type W95 FAT32 (LBA). + echo "n" #Type n, + echo "p" #then p for primary, + echo "2" #2 for the second partition on the drive, + echo "" #Default start sector + echo "" #Default end sector + echo "w" #Write the partition table and exit by typing w. + )| fdisk "$device_path" || error + fi info "Format boot partition..." && - mkfs.vfat "$boot_partition_path" || error "Format boot is not possible." + mkfs.vfat "$boot_partition_path" || error info "Format root partition..." && - mkfs.ext4 "$root_partition_path" || error "Format root is not possible." + mkfs.ext4 "$root_partition_path" || error mount_partitions; @@ -373,7 +405,6 @@ if [ "$update_system" == "y" ] esac fi -question "Should the system be encrypted?(y/N)" && read -r encrypt_system if [ "$encrypt_system" == "y" ] then # @see https://gist.github.com/gea0/4fc2be0cb7a74d0e7cc4322aed710d38 From 8b03f8bda6784edbd0efbb33fe2902f5441fbfc8 Mon Sep 17 00:00:00 2001 From: "Kevin Veen-Birkenbach [aka. Frantz]" Date: Thu, 11 Jun 2020 20:19:31 +0200 Subject: [PATCH 22/36] Implemented draft for encrypted pi --- scripts/image/setup.sh | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/scripts/image/setup.sh b/scripts/image/setup.sh index 5a8b1f7..9cd9bcd 100644 --- a/scripts/image/setup.sh +++ b/scripts/image/setup.sh @@ -253,7 +253,7 @@ if [ "$transfer_image" = "y" ] echo "" #Default start sector echo "" #Default end sector echo "w" #Write the partition table and exit by typing w. - )| fdisk "$device_path" || error + )| fdisk "$device_path" || error fi info "Format boot partition..." && @@ -414,6 +414,11 @@ if [ "$encrypt_system" == "y" ] mkinitcpio_rescue_path="$mkinitcpio_path.$(date +%s).rescue" search_modules="MODULES=()" replace_modules="MODULES=(g_cdc usb_f_acm usb_f_ecm smsc95xx g_ether)" + standart_luks_password="luks_password" + boot_txt_path="/boot/boot.txt" + boot_txt_uncomment_line="part uuid ${devtype} ${devnum}:2 uuid" + boot_txt_setenv_origin="setenv bootargs console=ttyS1,115200 console=tty0 root=PARTUUID=\${uuid} rw rootwait smsc95xx.macaddr=\"\${usbethaddr}\"" + boot_txt_setenv_replace="setenv bootargs earlyprintk console=ttyS1,115200 console=tty0 ip=::::pi_rescue:eth0:dhcp cryptdevice=$encrypted_partition_path:root root=/dev/mapper/root rw rootwait smsc95xx.macaddr=\"\${usbethaddr}\"" info "Setup encryption..." && ( echo "pacman --noconfirm -S --needed $(get_packages "server/luks")" @@ -422,6 +427,20 @@ if [ "$encrypt_system" == "y" ] echo "sed -i 's/$search_modules/$replace_modules/g' $mkinitcpio_path" echo "sed -i 's/$search_hooks/$replace_hooks/g' $mkinitcpio_path" echo "mkinitcpio -P" + echo "( echo 'YES' + echo '$standart_luks_password' + echo '$standart_luks_password' + )|sudo cryptsetup luksFormat -c aes-xts-plain64 -s 512 -h sha512 --use-random -i 1000 $encrypted_partition_path" + echo "echo $standart_luks_password | sudo cryptsetup luksOpen $encrypted_partition_path root" + echo "mkfs.ext4 /dev/mapper/root" + echo "mount /dev/mapper/root /mnt" + echo "rsync --info=progress2 -axHAX / /mnt/" + echo "echo '/dev/mapper/root / ext4 defaults,noatime 0 1' >> /mnt/etc/fstab" + echo "echo 'root $encrypted_partition_path none luks' >> /mnt/etc/crypttab" + echo "sed -i 's/$boot_txt_uncomment_line/#$boot_txt_uncomment_line/g' $boot_txt_path" + echo "sed -i 's/$boot_txt_setenv_origin/$boot_txt_setenv_replace/g' $boot_txt_path" + echo "cd /boot/ && ./mkscr" + echo "exit" ) | chroot "$root_mount_path" /bin/bash || error fi From 00428e1f7db51f8acc5d74fc76eef4e84c5c7cca Mon Sep 17 00:00:00 2001 From: "Kevin Veen-Birkenbach [aka. Frantz]" Date: Thu, 11 Jun 2020 21:22:10 +0200 Subject: [PATCH 23/36] Solved mount bug --- scripts/image/setup.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/image/setup.sh b/scripts/image/setup.sh index 9cd9bcd..d3446ba 100644 --- a/scripts/image/setup.sh +++ b/scripts/image/setup.sh @@ -298,13 +298,13 @@ if [ "$transfer_image" = "y" ] fi info "Start regular mounting procedure..." -if mount | grep -q "$boot_mount_path" +if mount | grep -q "$boot_partition_path" then - info "$boot_mount_path is allready mounted..." + info "$boot_partition_path is allready mounted..." else - if mount | grep -q "$root_mount_path" + if mount | grep -q "$root_partition_path" then - info "$root_mount_path is allready mounted..." + info "$root_partition_path is allready mounted..." else mount_partitions fi From b2cd8f1725bc73dc4c52906ba64231dc0550434a Mon Sep 17 00:00:00 2001 From: "Kevin Veen-Birkenbach [aka. Frantz]" Date: Thu, 11 Jun 2020 22:04:21 +0200 Subject: [PATCH 24/36] Deleted unnecessary line --- scripts/image/setup.sh | 3 --- 1 file changed, 3 deletions(-) diff --git a/scripts/image/setup.sh b/scripts/image/setup.sh index d3446ba..659da1f 100644 --- a/scripts/image/setup.sh +++ b/scripts/image/setup.sh @@ -233,9 +233,6 @@ if [ "$transfer_image" = "y" ] echo "" #Default end sector echo "w" #Write the partition table and exit by typing w. )| fdisk "$device_path" || error - - info "Format encrypted partition..." && - mkfs.ext4 "$encrypted_partition_path" || error else info "Creating partitions..." && ( echo "o" #Type o. This will clear out any partitions on the drive. From b40a3c9696a9e5ca8146193fe9b76b60e0713765 Mon Sep 17 00:00:00 2001 From: "Kevin Veen-Birkenbach [aka. Frantz]" Date: Fri, 12 Jun 2020 09:30:45 +0200 Subject: [PATCH 25/36] Implemented some rescue options and variables --- scripts/image/setup.sh | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/scripts/image/setup.sh b/scripts/image/setup.sh index 659da1f..6de4958 100644 --- a/scripts/image/setup.sh +++ b/scripts/image/setup.sh @@ -405,17 +405,24 @@ fi if [ "$encrypt_system" == "y" ] then # @see https://gist.github.com/gea0/4fc2be0cb7a74d0e7cc4322aed710d38 + rescue_suffix=".$(date +%s).rescue" search_hooks="HOOKS=(base udev autodetect modconf block filesystems keyboard fsck)" replace_hooks="HOOKS=(base udev autodetect modconf block sleep netconf dropbear encryptssh filesystems keyboard fsck)" mkinitcpio_path="/etc/mkinitcpio.conf" - mkinitcpio_rescue_path="$mkinitcpio_path.$(date +%s).rescue" + mkinitcpio_rescue_path="$mkinitcpio_path$rescue_suffix" search_modules="MODULES=()" replace_modules="MODULES=(g_cdc usb_f_acm usb_f_ecm smsc95xx g_ether)" standart_luks_password="luks_password" + root_mapper_path="/dev/mapper/root" + fstab_path="/mnt/etc/fstab" + fstab_rescue_path="$fstab_path$rescue_suffix" + crypttab_path="/mnt/etc/crypttab" + crypttab_rescue_path="$crypttab_path$rescue_suffix" boot_txt_path="/boot/boot.txt" + boot_txt_rescue_path="/boot/boot.txt$rescue_suffix" boot_txt_uncomment_line="part uuid ${devtype} ${devnum}:2 uuid" boot_txt_setenv_origin="setenv bootargs console=ttyS1,115200 console=tty0 root=PARTUUID=\${uuid} rw rootwait smsc95xx.macaddr=\"\${usbethaddr}\"" - boot_txt_setenv_replace="setenv bootargs earlyprintk console=ttyS1,115200 console=tty0 ip=::::pi_rescue:eth0:dhcp cryptdevice=$encrypted_partition_path:root root=/dev/mapper/root rw rootwait smsc95xx.macaddr=\"\${usbethaddr}\"" + boot_txt_setenv_replace="setenv bootargs console=ttyS1,115200 console=tty0 ip=::::pi_rescue:eth0:dhcp cryptdevice=$encrypted_partition_path:root root=$root_mapper_path rw rootwait smsc95xx.macaddr=\"\${usbethaddr}\"" info "Setup encryption..." && ( echo "pacman --noconfirm -S --needed $(get_packages "server/luks")" @@ -429,13 +436,16 @@ if [ "$encrypt_system" == "y" ] echo '$standart_luks_password' )|sudo cryptsetup luksFormat -c aes-xts-plain64 -s 512 -h sha512 --use-random -i 1000 $encrypted_partition_path" echo "echo $standart_luks_password | sudo cryptsetup luksOpen $encrypted_partition_path root" - echo "mkfs.ext4 /dev/mapper/root" - echo "mount /dev/mapper/root /mnt" + echo "mkfs.ext4 $root_mapper_path" + echo "mount $root_mapper_path /mnt" echo "rsync --info=progress2 -axHAX / /mnt/" - echo "echo '/dev/mapper/root / ext4 defaults,noatime 0 1' >> /mnt/etc/fstab" - echo "echo 'root $encrypted_partition_path none luks' >> /mnt/etc/crypttab" - echo "sed -i 's/$boot_txt_uncomment_line/#$boot_txt_uncomment_line/g' $boot_txt_path" - echo "sed -i 's/$boot_txt_setenv_origin/$boot_txt_setenv_replace/g' $boot_txt_path" + echo "cp -v $fstab_path $fstab_rescue_path" + echo "echo '$root_mapper_path / ext4 defaults,noatime 0 1' >> $fstab_path" + echo "cp -v $crypttab_path $crypttab_rescue_path" + echo "echo 'root $encrypted_partition_path none luks' >> $crypttab_path" + echo "cp -v $boot_txt_path $boot_txt_rescue_path" + echo "sed -i 's/$boot_txt_uncomment_line/#$boot_txt_uncomment_line/g' $boot_txt_path" #@todo doesn't work yet + echo "sed -i 's/$boot_txt_setenv_origin/$boot_txt_setenv_replace/g' $boot_txt_path" #@todo doesn't work yet echo "cd /boot/ && ./mkscr" echo "exit" ) | chroot "$root_mount_path" /bin/bash || error From 38d0cc66e5625a5fb3b55c8d17ff594380468d1a Mon Sep 17 00:00:00 2001 From: "Kevin Veen-Birkenbach [aka. Frantz]" Date: Fri, 12 Jun 2020 09:38:13 +0200 Subject: [PATCH 26/36] Optimized hostname procedures --- scripts/image/setup.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/scripts/image/setup.sh b/scripts/image/setup.sh index 6de4958..1171150 100644 --- a/scripts/image/setup.sh +++ b/scripts/image/setup.sh @@ -369,14 +369,17 @@ if [ "$change_password" == "y" ] 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 hostname; - echo "$hostname" > "$root_mount_path""etc/hostname" || error + 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" question "Should the system be updated?(y/N)" && read -r update_system if [ "$update_system" == "y" ] @@ -422,7 +425,7 @@ if [ "$encrypt_system" == "y" ] boot_txt_rescue_path="/boot/boot.txt$rescue_suffix" boot_txt_uncomment_line="part uuid ${devtype} ${devnum}:2 uuid" boot_txt_setenv_origin="setenv bootargs console=ttyS1,115200 console=tty0 root=PARTUUID=\${uuid} rw rootwait smsc95xx.macaddr=\"\${usbethaddr}\"" - boot_txt_setenv_replace="setenv bootargs console=ttyS1,115200 console=tty0 ip=::::pi_rescue:eth0:dhcp cryptdevice=$encrypted_partition_path:root root=$root_mapper_path rw rootwait smsc95xx.macaddr=\"\${usbethaddr}\"" + boot_txt_setenv_replace="setenv bootargs console=ttyS1,115200 console=tty0 ip=::::$target_hostname:eth0:dhcp cryptdevice=$encrypted_partition_path:root root=$root_mapper_path rw rootwait smsc95xx.macaddr=\"\${usbethaddr}\"" info "Setup encryption..." && ( echo "pacman --noconfirm -S --needed $(get_packages "server/luks")" From faf82399184f75e0427fdeaf8fe00ad9d5929274 Mon Sep 17 00:00:00 2001 From: "Kevin Veen-Birkenbach [aka. Frantz]" Date: Fri, 12 Jun 2020 09:48:46 +0200 Subject: [PATCH 27/36] Optimized seeding --- scripts/image/setup.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/image/setup.sh b/scripts/image/setup.sh index 1171150..acdc767 100644 --- a/scripts/image/setup.sh +++ b/scripts/image/setup.sh @@ -424,8 +424,8 @@ if [ "$encrypt_system" == "y" ] boot_txt_path="/boot/boot.txt" boot_txt_rescue_path="/boot/boot.txt$rescue_suffix" boot_txt_uncomment_line="part uuid ${devtype} ${devnum}:2 uuid" - boot_txt_setenv_origin="setenv bootargs console=ttyS1,115200 console=tty0 root=PARTUUID=\${uuid} rw rootwait smsc95xx.macaddr=\"\${usbethaddr}\"" - boot_txt_setenv_replace="setenv bootargs console=ttyS1,115200 console=tty0 ip=::::$target_hostname:eth0:dhcp cryptdevice=$encrypted_partition_path:root root=$root_mapper_path rw rootwait smsc95xx.macaddr=\"\${usbethaddr}\"" + 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=$encrypted_partition_path:root root=$root_mapper_path rw rootwait smsc95xx.macaddr=\"\${usbethaddr}\""| sed -e 's/[\/&]/\\&/g') info "Setup encryption..." && ( echo "pacman --noconfirm -S --needed $(get_packages "server/luks")" From f51eaa12e61ac4f6917286c5f52d93d750f398cc Mon Sep 17 00:00:00 2001 From: "Kevin Veen-Birkenbach [aka. Frantz]" Date: Fri, 12 Jun 2020 10:57:58 +0200 Subject: [PATCH 28/36] Optimized sed --- scripts/image/setup.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/scripts/image/setup.sh b/scripts/image/setup.sh index acdc767..c95487d 100644 --- a/scripts/image/setup.sh +++ b/scripts/image/setup.sh @@ -423,7 +423,7 @@ if [ "$encrypt_system" == "y" ] crypttab_rescue_path="$crypttab_path$rescue_suffix" boot_txt_path="/boot/boot.txt" boot_txt_rescue_path="/boot/boot.txt$rescue_suffix" - boot_txt_uncomment_line="part uuid ${devtype} ${devnum}:2 uuid" + 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=$encrypted_partition_path:root root=$root_mapper_path rw rootwait smsc95xx.macaddr=\"\${usbethaddr}\""| sed -e 's/[\/&]/\\&/g') info "Setup encryption..." && @@ -443,12 +443,15 @@ if [ "$encrypt_system" == "y" ] echo "mount $root_mapper_path /mnt" echo "rsync --info=progress2 -axHAX / /mnt/" echo "cp -v $fstab_path $fstab_rescue_path" - echo "echo '$root_mapper_path / ext4 defaults,noatime 0 1' >> $fstab_path" + echo "echo '$root_mapper_path / ext4 defaults,noatime 0 1' >> $fstab_path" + echo "echo \"$fstab_path:\" && cat \"$fstab_path\"" echo "cp -v $crypttab_path $crypttab_rescue_path" echo "echo 'root $encrypted_partition_path none luks' >> $crypttab_path" + echo "echo \"$crypttab_path:\" && cat \"$crypttab_path\"" echo "cp -v $boot_txt_path $boot_txt_rescue_path" - echo "sed -i 's/$boot_txt_uncomment_line/#$boot_txt_uncomment_line/g' $boot_txt_path" #@todo doesn't work yet + echo "sed -i 's/$boot_txt_delete_line//g' $boot_txt_path" #@todo doesn't work yet echo "sed -i 's/$boot_txt_setenv_origin/$boot_txt_setenv_replace/g' $boot_txt_path" #@todo doesn't work yet + echo "echo \"$boot_txt_path:\" && cat \"$boot_txt_path\"" echo "cd /boot/ && ./mkscr" echo "exit" ) | chroot "$root_mount_path" /bin/bash || error From b1cee3a6e1ff379fbb2093bec867f2b73465a8d2 Mon Sep 17 00:00:00 2001 From: "Kevin Veen-Birkenbach [aka. Frantz]" Date: Fri, 12 Jun 2020 11:07:57 +0200 Subject: [PATCH 29/36] Optimized shellcheck hints --- scripts/base.sh | 6 +++++- scripts/image/base.sh | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/scripts/base.sh b/scripts/base.sh index aae9d51..69acf88 100644 --- a/scripts/base.sh +++ b/scripts/base.sh @@ -3,6 +3,10 @@ # This script contains the global program variables and functions # # shellcheck disable=SC2034 #Deactivate checking of unused variables +# shellcheck disable=SC2003 #Deactivate "expr is antiquated" +# shellcheck disable=SC2015 #Deactivate bool hint +# shellcheck disable=SC2005 #Remove useless echo hint +# shellcheck disable=SC2010 #Deactivate ls | grep hint REPOSITORY_PATH=$(readlink -f "$(dirname "$(readlink -f "${0}")")/../../") # Propably this can be optimized CONFIGURATION_PATH="$REPOSITORY_PATH""/configuration/" @@ -76,7 +80,7 @@ set_device_path(){ error "$device_path is not valid device." fi # @see https://www.heise.de/ct/hotline/Optimale-Blockgroesse-fuer-dd-2056768.html - OPTIMAL_BLOCKSIZE=$(expr 64 \* "$(sudo cat /sys/block/$device/queue/physical_block_size)") && + OPTIMAL_BLOCKSIZE=$(expr 64 \* "$(sudo cat /sys/block/"$device"/queue/physical_block_size)") && info "Device path set to: $device_path" && info "Optimal blocksize set to: $OPTIMAL_BLOCKSIZE" || error diff --git a/scripts/image/base.sh b/scripts/image/base.sh index e734fac..fa28e13 100644 --- a/scripts/image/base.sh +++ b/scripts/image/base.sh @@ -6,6 +6,7 @@ # shellcheck disable=SC2010 # ls | grep allowed # shellcheck source=/dev/null # Deactivate SC1090 # shellcheck disable=SC2015 # Deactivate bools hints +# shellcheck disable=SC2154 # Deactivate referenced but not assigned hints source "$(dirname "$(readlink -f "${0}")")/../base.sh" || (echo "Loading base.sh failed." && exit 1) # Writes the full partition name From 5de37db883c3978f788a34f936d30595bdcc48f5 Mon Sep 17 00:00:00 2001 From: "Kevin Veen-Birkenbach [aka. Frantz]" Date: Fri, 12 Jun 2020 11:41:08 +0200 Subject: [PATCH 30/36] Solved shellcheck errors --- scripts/client/setup.sh | 2 +- scripts/data/export-to-system.sh | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/scripts/client/setup.sh b/scripts/client/setup.sh index 4c568c1..f5f3cfc 100644 --- a/scripts/client/setup.sh +++ b/scripts/client/setup.sh @@ -152,7 +152,7 @@ install_gnome_extension(){ if [ "$DESKTOP_SESSION" == "gnome" ]; then info "Synchronizing gnome tools..." && - sudo pacman -S $(get_packages "client/pacman/gnome") || error "Syncronisation failed." + sudo pacman -S "$(get_packages 'client/pacman/gnome')" || error "Syncronisation failed." info "Setting up gnome dash favourites..." && gsettings set org.gnome.shell favorite-apps "['org.gnome.Nautilus.desktop', 'org.gnome.Terminal.desktop', diff --git a/scripts/data/export-to-system.sh b/scripts/data/export-to-system.sh index 1daa464..852cdf4 100644 --- a/scripts/data/export-to-system.sh +++ b/scripts/data/export-to-system.sh @@ -2,10 +2,12 @@ # Executes the import script in reverse mode # @author Kevin Veen-Birkenbach [aka. Frantz] # shellcheck source=/dev/null # Deactivate SC1090 +# shellcheck disable=SC2015 # Deactivating bool hint source "$(dirname "$(readlink -f "${0}")")/../base.sh" || (echo "Loading base.sh failed." && exit 1) bash "$SCRIPT_PATH""data/import-from-system.sh" reverse -info "Setting right permissions for importet files..." -chown -R $USER:$USER ~ -chmod -R 700 ~/.ssh -chmod 600 ~/.ssh/id_rsa -chmod 600 ~/.ssh/id_rsa.pub +info "Setting right permissions for importet files..." && +chown -R "$USER":"$USER" ~ && +chmod -R 700 ~/.ssh && +chmod 600 ~/.ssh/id_rsa && +chmod 600 ~/.ssh/id_rsa.pub || +error From 0943cab7548d34c37158a778b0257ee0a9e4a3e8 Mon Sep 17 00:00:00 2001 From: "Kevin Veen-Birkenbach [aka. Frantz]" Date: Tue, 16 Jun 2020 19:59:09 +0200 Subject: [PATCH 31/36] Umount root_mapper --- scripts/image/setup.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/image/setup.sh b/scripts/image/setup.sh index c95487d..47a2253 100644 --- a/scripts/image/setup.sh +++ b/scripts/image/setup.sh @@ -453,6 +453,7 @@ if [ "$encrypt_system" == "y" ] echo "sed -i 's/$boot_txt_setenv_origin/$boot_txt_setenv_replace/g' $boot_txt_path" #@todo doesn't work yet echo "echo \"$boot_txt_path:\" && cat \"$boot_txt_path\"" echo "cd /boot/ && ./mkscr" + echo "umount $root_mapper_path" echo "exit" ) | chroot "$root_mount_path" /bin/bash || error fi From 9cab8f25ed112ed6aaf5a563000454f6fbef6473 Mon Sep 17 00:00:00 2001 From: "Kevin Veen-Birkenbach [aka. Frantz]" Date: Tue, 16 Jun 2020 20:04:35 +0200 Subject: [PATCH 32/36] Added libreoffice config file --- scripts/data/import-from-system.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/data/import-from-system.sh b/scripts/data/import-from-system.sh index dfd0a85..dd8a8ce 100644 --- a/scripts/data/import-from-system.sh +++ b/scripts/data/import-from-system.sh @@ -11,6 +11,7 @@ source "$(dirname "$(readlink -f "${0}")")/../base.sh" || (echo "Loading base.sh declare -a BACKUP_LIST=("$HOME/.ssh/" \ "$HOME/.gitconfig" \ "$HOME/.atom/config.cson" \ + "$HOME/.projectlibre/projectlibre.conf" \ "$HOME/.local/share/rhythmbox/rhythmdb.xml" \ "$HOME/.config/keepassxc/keepassxc.ini" \ "$HOME/Documents/certificates/" \ From 32d4927ad4f0cb8b4a069d51f7eefdfe37a6d87d Mon Sep 17 00:00:00 2001 From: "Kevin Veen-Birkenbach [aka. Frantz]" Date: Wed, 24 Jun 2020 09:19:51 +0200 Subject: [PATCH 33/36] Optimized path --- scripts/base.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scripts/base.sh b/scripts/base.sh index 69acf88..eac1a79 100644 --- a/scripts/base.sh +++ b/scripts/base.sh @@ -7,8 +7,7 @@ # shellcheck disable=SC2015 #Deactivate bool hint # shellcheck disable=SC2005 #Remove useless echo hint # shellcheck disable=SC2010 #Deactivate ls | grep hint - -REPOSITORY_PATH=$(readlink -f "$(dirname "$(readlink -f "${0}")")/../../") # Propably this can be optimized +REPOSITORY_PATH="$(readlink -f "${0}" | sed -e 's/\/scripts\/.*//g')" CONFIGURATION_PATH="$REPOSITORY_PATH""/configuration/" PACKAGE_PATH="$CONFIGURATION_PATH""packages/" TEMPLATE_PATH="$CONFIGURATION_PATH""templates/"; From 31c7950547782d43b95c4dcde49ca840fd80dab9 Mon Sep 17 00:00:00 2001 From: "Kevin Veen-Birkenbach [aka. Frantz]" Date: Wed, 24 Jun 2020 09:31:57 +0200 Subject: [PATCH 34/36] Optimized right permission setting --- scripts/data/export-to-system.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/scripts/data/export-to-system.sh b/scripts/data/export-to-system.sh index 852cdf4..698b6ab 100644 --- a/scripts/data/export-to-system.sh +++ b/scripts/data/export-to-system.sh @@ -6,8 +6,7 @@ source "$(dirname "$(readlink -f "${0}")")/../base.sh" || (echo "Loading base.sh failed." && exit 1) bash "$SCRIPT_PATH""data/import-from-system.sh" reverse info "Setting right permissions for importet files..." && -chown -R "$USER":"$USER" ~ && chmod -R 700 ~/.ssh && chmod 600 ~/.ssh/id_rsa && -chmod 600 ~/.ssh/id_rsa.pub || -error +chmod 600 ~/.ssh/id_rsa.pub || error "Failed to set correct ssh permissions" +chown -R "$USER":"$USER" ~ || warning "Not all files could be owned by user \"$USER\"..." From 44189e9c94ca1134e11f3a49d9c1fd4e3c7e9083 Mon Sep 17 00:00:00 2001 From: "Kevin Veen-Birkenbach [aka. Frantz]" Date: Thu, 2 Jul 2020 20:39:45 +0200 Subject: [PATCH 35/36] Added Microsoft fonts --- configuration/packages/client/yay/general.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/configuration/packages/client/yay/general.txt b/configuration/packages/client/yay/general.txt index 38c14c3..808396d 100644 --- a/configuration/packages/client/yay/general.txt +++ b/configuration/packages/client/yay/general.txt @@ -8,3 +8,5 @@ libpurple-carbons eclipse-java # language server ccls +# office +ttf-ms-fonts From 2181da669e322a8550073a6aa3fb10ff46e429cf Mon Sep 17 00:00:00 2001 From: "Kevin Veen-Birkenbach [aka. Frantz]" Date: Wed, 29 Jul 2020 20:49:51 +0200 Subject: [PATCH 36/36] Added folder with health documents --- scripts/data/import-from-system.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/data/import-from-system.sh b/scripts/data/import-from-system.sh index dd8a8ce..6bffa2a 100644 --- a/scripts/data/import-from-system.sh +++ b/scripts/data/import-from-system.sh @@ -18,6 +18,7 @@ declare -a BACKUP_LIST=("$HOME/.ssh/" \ "$HOME/Documents/recovery_codes/" \ "$HOME/Documents/identity/" \ "$HOME/Documents/passwords/" \ + "$HOME/Documents/health/" \ "$HOME/Documents/licenses/"); if [ -z "$(mount | grep "$DECRYPTED_PATH")" ]