Przeglądaj źródła

scripts/InstallScripts: fix shellcheck SC2162 'read without -r will mangle backslashes.'

Austin English 4 lat temu
rodzic
commit
33667c4565

+ 3 - 3
scripts/InstallScripts/InstallPackages.sh

@@ -24,7 +24,7 @@ cat $DIR/icons/ascii-icon.txt
 echo ""
 echo ""
 
 
 while true; do
 while true; do
-    read -p "Install (X)fce4, (L)xqt or (G)nome, if unsure choose (X)fce: " XL
+    read -r -p "Install (X)fce4, (L)xqt or (G)nome, if unsure choose (X)fce: " XL
     case $XL in
     case $XL in
         [Gg]* ) DE=gnome; break;;
         [Gg]* ) DE=gnome; break;;
         [Xx]* ) DE=xfce; break;;
         [Xx]* ) DE=xfce; break;;
@@ -175,7 +175,7 @@ done
 #Force a safe username
 #Force a safe username
 while true; do
 while true; do
     echo "-----Enter new username:-----"
     echo "-----Enter new username:-----"
-    read username
+    read -r username
     #ensure no whitespace
     #ensure no whitespace
     case $username in *\ *) echo usernames may not contain whitespace;;  *) break;; esac
     case $username in *\ *) echo usernames may not contain whitespace;;  *) break;; esac
 done
 done
@@ -183,7 +183,7 @@ until adduser $username --gecos ""
 do
 do
     while true; do
     while true; do
         echo "-----Enter new username:-----"
         echo "-----Enter new username:-----"
-        read username
+        read -r username
         #ensure no whitespace
         #ensure no whitespace
         case $username in *\ *) echo usernames may not contain whitespace;;  *) break;; esac
         case $username in *\ *) echo usernames may not contain whitespace;;  *) break;; esac
     done
     done

+ 6 - 6
scripts/InstallScripts/InstallPrawnOS.sh

@@ -37,7 +37,7 @@ main() {
     echo "Expand or Install?: "
     echo "Expand or Install?: "
     echo "The currently booted device is ${BOOT_DEVICE}"
     echo "The currently booted device is ${BOOT_DEVICE}"
     while true; do
     while true; do
-        read -p "[I]nstall or [E]xpand?" IE
+        read -r -p "[I]nstall or [E]xpand?" IE
         case $IE in
         case $IE in
             [Ii]* ) install; break;;
             [Ii]* ) install; break;;
             [Ee]* ) expand; break;;
             [Ee]* ) expand; break;;
@@ -54,7 +54,7 @@ install() {
     echo "Please ensure you have only have the booted device and the desired target device inserted."
     echo "Please ensure you have only have the booted device and the desired target device inserted."
     echo "The currently booted device is ${BOOT_DEVICE}"
     echo "The currently booted device is ${BOOT_DEVICE}"
     while true; do
     while true; do
-        read -p "[I]nternal Emmc, [S]D card, or [U]SB device?: " ISU
+        read -r -p "[I]nternal Emmc, [S]D card, or [U]SB device?: " ISU
         case $ISU in
         case $ISU in
             [Ii]* ) TARGET=/dev/mmcblk2p; break;;
             [Ii]* ) TARGET=/dev/mmcblk2p; break;;
             [Ss]* ) TARGET=/dev/mmcblk0p; break;;
             [Ss]* ) TARGET=/dev/mmcblk0p; break;;
@@ -87,7 +87,7 @@ install() {
 
 
     #Now on to the installation, basically copy InstallToInternal.sh
     #Now on to the installation, basically copy InstallToInternal.sh
     while true; do
     while true; do
-        read -p "This will ERASE ALL DATA ON ${TARGET_NO_P} and reboot when finished, do you want to continue? [y/N]" yn
+        read -r -p "This will ERASE ALL DATA ON ${TARGET_NO_P} and reboot when finished, do you want to continue? [y/N]" yn
         case $yn in
         case $yn in
             [Yy]* ) break;;
             [Yy]* ) break;;
             [Nn]* ) exit;;
             [Nn]* ) exit;;
@@ -160,7 +160,7 @@ install() {
     echo "${ROOT_PARTITION} / ext4 defaults,noatime 0 1" > $INSTALL_MOUNT/etc/fstab
     echo "${ROOT_PARTITION} / ext4 defaults,noatime 0 1" > $INSTALL_MOUNT/etc/fstab
 
 
     while true; do
     while true; do
-        read -p "Install a desktop environment and the supporting packages? [Y/n]" ins
+        read -r -p "Install a desktop environment and the supporting packages? [Y/n]" ins
         case $ins in
         case $ins in
             [Yy]* ) install_packages $INSTALL_MOUNT; break;;
             [Yy]* ) install_packages $INSTALL_MOUNT; break;;
             [Nn]* ) break;;
             [Nn]* ) break;;
@@ -179,7 +179,7 @@ install() {
     fi
     fi
     echo "Please remove the booted device after power off is complete"
     echo "Please remove the booted device after power off is complete"
     while true; do
     while true; do
-        read -p "Reboot? [y/N]" re
+        read -r -p "Reboot? [y/N]" re
         case $re in
         case $re in
             [Yy]* ) reboot;;
             [Yy]* ) reboot;;
             [Nn]* ) exit;;
             [Nn]* ) exit;;
@@ -273,7 +273,7 @@ expand() {
     resize2fs -f ${BOOT_DEVICE}2
     resize2fs -f ${BOOT_DEVICE}2
     echo "/dev/${BOOT_DEVICE}2 / ext4 defaults,noatime 0 1" > /etc/fstab
     echo "/dev/${BOOT_DEVICE}2 / ext4 defaults,noatime 0 1" > /etc/fstab
     while true; do
     while true; do
-        read -p "Install a desktop environment and the supporting packages? [Y/n]" ins
+        read -r -p "Install a desktop environment and the supporting packages? [Y/n]" ins
         case $ins in
         case $ins in
             [Yy]* ) /InstallResources/InstallPackages.sh; reboot;;
             [Yy]* ) /InstallResources/InstallPackages.sh; reboot;;
             [Nn]* ) exit;;
             [Nn]* ) exit;;