Added btrfs software

This commit is contained in:
Kevin Veen-Birkenbach 2020-10-04 15:38:04 +02:00
parent 4949899bf7
commit 9cd1078007

View File

@ -6,6 +6,21 @@
# @see https://wiki.polaire.nl/doku.php?id=archlinux-raspberry-encrypted # @see https://wiki.polaire.nl/doku.php?id=archlinux-raspberry-encrypted
source "$(dirname "$(readlink -f "${0}")")/base.sh" || (echo "Loading base.sh failed." && exit 1) source "$(dirname "$(readlink -f "${0}")")/base.sh" || (echo "Loading base.sh failed." && exit 1)
install(){
info "Installing $1..."
case "$os" in
"arch"|"manjaro")
echo "pacman --noconfirm -S --needed $1" | chroot "$root_mount_path" /bin/bash || error
;;
"moode"|"retropie")
echo "yes | apt install $1" | chroot "$root_mount_path" /bin/bash || error
;;
*)
error "Package manager not supported."
;;
esac
}
info "Setupscript for images started..." info "Setupscript for images started..."
info "Checking if root..." info "Checking if root..."
@ -36,12 +51,11 @@ if mount | grep -q "$device_path"
error "Device $device_path is allready mounted. Umount with \"umount $device_path*\"." error "Device $device_path is allready mounted. Umount with \"umount $device_path*\"."
fi fi
question "Please type in which distribution should be used(e.g.:arch,moode,retropie,manjaro):" && read -r os || error question "Which distribution should be used(e.g.:arch,moode,retropie,manjaro):" && read -r os || error
case "$os" in case "$os" in
"arch") "arch")
question "Should the system be encrypted?(y/N)" && read -r encrypt_system question "Which Raspberry Pi will be used(e.g.:1,2,3,4,aarch64):" && read -r version
question "Please type in 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/";
if [ "$version" == "1" ] if [ "$version" == "1" ]
then then
@ -51,7 +65,7 @@ case "$os" in
fi fi
;; ;;
"manjaro") "manjaro")
question "Please type in the version(e.g.:architect,gnome):" && read -r version question "Which version(e.g.:architect,gnome) should be used:" && read -r version
case "$version" in case "$version" in
"architect") "architect")
image_checksum="6b1c2fce12f244c1e32212767a9d3af2cf8263b2" image_checksum="6b1c2fce12f244c1e32212767a9d3af2cf8263b2"
@ -90,6 +104,8 @@ case "$os" in
;; ;;
esac esac
question "Should the system be encrypted?(y/N)" && read -r encrypt_system
info "Generating os-image..." info "Generating os-image..."
download_url="$base_download_url$imagename" download_url="$base_download_url$imagename"
image_path="$image_folder$imagename" image_path="$image_folder$imagename"
@ -111,8 +127,8 @@ if [ -f "$image_path" ]
then then
info "Image exist local. Download skipped." info "Image exist local. Download skipped."
else else
info "Image \"$imagename\" doesn't exist under local path \"$image_path\"." info "Image \"$imagename\" doesn't exist under local path \"$image_path\"." &&
info "Image \"$imagename\" gets downloaded from \"$download_url\"..." info "Image \"$imagename\" gets downloaded from \"$download_url\"..." &&
wget "$download_url" -O "$image_path" || error "Download from \"$download_url\" failed." wget "$download_url" -O "$image_path" || error "Download from \"$download_url\" failed."
fi fi
@ -130,8 +146,7 @@ make_mount_folders
set_partition_paths set_partition_paths
root_filesystem="btrfs" && question "Which filesystem should be used(e.g.:btrfs,ext4):" && read -r root_filesystem
info "The following filesystem will be used if possible:$root_filesystem" || error
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" ] if [ "$transfer_image" = "y" ]
@ -339,13 +354,21 @@ if [ "$update_system" == "y" ]
esac esac
fi fi
info "Installing software for filesystem $root_filesystem..."
if [ "$root_filesystem" == "btrfs" ]
then
install "btrfs-progs"
else
info "Skipped."
fi
if [ "$encrypt_system" == "y" ] if [ "$encrypt_system" == "y" ]
then then
# Adapted this instruction for setting up encrypted systems @see https://gist.github.com/gea0/4fc2be0cb7a74d0e7cc4322aed710d38 # Adapted this instruction for setting up encrypted systems @see https://gist.github.com/gea0/4fc2be0cb7a74d0e7cc4322aed710d38
info "Setup encryption..." && info "Setup encryption..." &&
info "Installing neccessary software..." && info "Installing neccessary software..." &&
echo "pacman --noconfirm -S --needed $(get_packages "server/luks")" | chroot "$root_mount_path" /bin/bash && install "$(get_packages "server/luks")" &&
dropbear_root_key_path="$root_mount_path""etc/dropbear/root_key" && dropbear_root_key_path="$root_mount_path""etc/dropbear/root_key" &&
info "Adding $target_authorized_keys to dropbear..." && info "Adding $target_authorized_keys to dropbear..." &&