Browse Source

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

Austin English 4 years ago
parent
commit
33667c4565

+ 3 - 3
scripts/InstallScripts/InstallPackages.sh

@@ -24,7 +24,7 @@ cat $DIR/icons/ascii-icon.txt
 echo ""
 
 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
         [Gg]* ) DE=gnome; break;;
         [Xx]* ) DE=xfce; break;;
@@ -175,7 +175,7 @@ done
 #Force a safe username
 while true; do
     echo "-----Enter new username:-----"
-    read username
+    read -r username
     #ensure no whitespace
     case $username in *\ *) echo usernames may not contain whitespace;;  *) break;; esac
 done
@@ -183,7 +183,7 @@ until adduser $username --gecos ""
 do
     while true; do
         echo "-----Enter new username:-----"
-        read username
+        read -r username
         #ensure no whitespace
         case $username in *\ *) echo usernames may not contain whitespace;;  *) break;; esac
     done

+ 6 - 6
scripts/InstallScripts/InstallPrawnOS.sh

@@ -37,7 +37,7 @@ main() {
     echo "Expand or Install?: "
     echo "The currently booted device is ${BOOT_DEVICE}"
     while true; do
-        read -p "[I]nstall or [E]xpand?" IE
+        read -r -p "[I]nstall or [E]xpand?" IE
         case $IE in
             [Ii]* ) install; 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 "The currently booted device is ${BOOT_DEVICE}"
     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
             [Ii]* ) TARGET=/dev/mmcblk2p; break;;
             [Ss]* ) TARGET=/dev/mmcblk0p; break;;
@@ -87,7 +87,7 @@ install() {
 
     #Now on to the installation, basically copy InstallToInternal.sh
     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
             [Yy]* ) break;;
             [Nn]* ) exit;;
@@ -160,7 +160,7 @@ install() {
     echo "${ROOT_PARTITION} / ext4 defaults,noatime 0 1" > $INSTALL_MOUNT/etc/fstab
 
     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
             [Yy]* ) install_packages $INSTALL_MOUNT; break;;
             [Nn]* ) break;;
@@ -179,7 +179,7 @@ install() {
     fi
     echo "Please remove the booted device after power off is complete"
     while true; do
-        read -p "Reboot? [y/N]" re
+        read -r -p "Reboot? [y/N]" re
         case $re in
             [Yy]* ) reboot;;
             [Nn]* ) exit;;
@@ -273,7 +273,7 @@ expand() {
     resize2fs -f ${BOOT_DEVICE}2
     echo "/dev/${BOOT_DEVICE}2 / ext4 defaults,noatime 0 1" > /etc/fstab
     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
             [Yy]* ) /InstallResources/InstallPackages.sh; reboot;;
             [Nn]* ) exit;;