Implemented first stepps for retro pie setup

This commit is contained in:
Kevin Veen-Birkenbach 2020-04-29 15:57:42 +02:00
parent 8152ca87e7
commit 1839ac6da1

View File

@ -15,15 +15,16 @@ echo
echo "@author Kevin Veen-Birkenbach [kevin@veen.world]" echo "@author Kevin Veen-Birkenbach [kevin@veen.world]"
echo "@since 2017-03-12" echo "@since 2017-03-12"
echo echo
echo "The images will be stored in /home/\$username/images/." echo ""
echo "Create temporary working folder in $working_folder"; echo "Create temporary working folder in $working_folder";
mkdir mkdir -v "$working_folder"
if [ $(id -u) != 0 ];then if [ "$(id -u)" != "0" ];then
echo "This script must be executed as root!" && exit 1 echo "This script must be executed as root!" && exit 1
fi fi
echo "Please type in the username from which the SSH-Key should be copied:" #@todo remove echo "Please type in the username from which the SSH-Key should be copied:" #@todo remove
read -r username; read -r username;
image_folder="/home/$username/Images/"; image_folder="/home/$username/Images/";
echo "The images will be stored in /home/\$username/images/."
echo "List of actual mounted devices:" echo "List of actual mounted devices:"
echo echo
ls -lasi /dev/ | grep -E "sd|mm" ls -lasi /dev/ | grep -E "sd|mm"
@ -59,7 +60,7 @@ case "$os" in
imagename="ArchLinuxARM-rpi-4-latest.tar.gz" imagename="ArchLinuxARM-rpi-4-latest.tar.gz"
;; ;;
*) *)
os_does_not_support_raspberry_version_error $os $version os_does_not_support_raspberry_version_error "$os" "$version"
;; ;;
esac esac
;; ;;
@ -82,7 +83,7 @@ case "$os" in
imagename="retropie-buster-4.6-rpi4.img.gz" imagename="retropie-buster-4.6-rpi4.img.gz"
;; ;;
*) *)
os_does_not_support_raspberry_version_error $os $version os_does_not_support_raspberry_version_error "$os" "$version"
;; ;;
esac esac
;; ;;
@ -98,13 +99,13 @@ if [ \! -f "$imagepath" ]
if [ \! -f "$imagepath" ] if [ \! -f "$imagepath" ]
then then
echo "Image \"$imagename\" gets downloaded from \"$download_url\"" echo "Image \"$imagename\" gets downloaded from \"$download_url\""
wget $download_url wget "$download_url"
fi fi
fi fi
case "$os" in case "$os" in
"arch") "arch")
bootpath=$workingpath"boot" bootpath="$workingpath""boot"
rootpath=$workingpath"root" rootpath="$workingpath""root"
ssh_key_source="/home/$username/.ssh/id_rsa.pub" ssh_key_source="/home/$username/.ssh/id_rsa.pub"
ssh_key_target="$rootpath/home/$username/.ssh/authorized_keys" ssh_key_target="$rootpath/home/$username/.ssh/authorized_keys"
@ -137,13 +138,13 @@ case "$os" in
#Bootpartion formatieren und mounten #Bootpartion formatieren und mounten
echo "Generate and mount boot-partition..." echo "Generate and mount boot-partition..."
mkfs.vfat "$ofiboot" mkfs.vfat "$ofiboot"
mkdir "$bootpath" mkdir -v "$bootpath"
mount "$ofiboot" "$bootpath" mount "$ofiboot" "$bootpath"
#Rootpartition formatieren und mounten #Rootpartition formatieren und mounten
echo "Generate and mount root-partition..." echo "Generate and mount root-partition..."
mkfs.ext4 "$ofiroot" mkfs.ext4 "$ofiroot"
mkdir "$rootpath" mkdir -v "$rootpath"
mount "$ofiroot" "$rootpath" mount "$ofiroot" "$rootpath"
echo "Die Root-Dateien werden auf die SD-Karte aufgespielt..." echo "Die Root-Dateien werden auf die SD-Karte aufgespielt..."
@ -151,7 +152,7 @@ case "$os" in
sync sync
echo "Die Boot-Dateien werden auf die SD-Karte aufgespielt..." echo "Die Boot-Dateien werden auf die SD-Karte aufgespielt..."
mv -v $rootpath"/boot/"* "$bootpath" mv -v "$rootpath/boot/"* "$bootpath"
if [ "$username" != "" ] && [ -f "$ssh_key_source" ] if [ "$username" != "" ] && [ -f "$ssh_key_source" ]
then then
@ -166,9 +167,12 @@ case "$os" in
echo "Unmount partitions..." echo "Unmount partitions..."
umount -v "$rootpath" "$bootpath" umount -v "$rootpath" "$bootpath"
;;
"retropie")
unzip -p "$imagepath" | sudo dd of="$of_device" bs=4M conv=fsync
;;
*) *)
echo "The operation system \"$os\" is not supported yet!" && exit 1; echo "The operation system \"$os\" is not supported yet!" && exit 1;
;; ;;
esac esac
rm -r "$working_folder" rm -r "$working_folder"