Ver Fonte

Merge pull request #176 from austin987/misc-shellcheck

misc shellcheck fixes
SolidHal há 3 anos atrás
pai
commit
dbfcc5fcc5

+ 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

+ 7 - 7
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;;
@@ -71,7 +71,7 @@ install() {
             TARGET=/dev/sda
             TARGET=/dev/sda
         fi
         fi
     fi
     fi
-    if [[ $TARGET == $BOOT_DEVICE ]]
+    if [[ "$TARGET" == "$BOOT_DEVICE" ]]
     then
     then
         echo "Can't install to booted device, please ensure you have *only* the booted device and target device inserted"
         echo "Can't install to booted device, please ensure you have *only* the booted device and target device inserted"
         exit
         exit
@@ -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;;

+ 0 - 2
scripts/InstallScripts/UpgradeKernel.sh

@@ -1,4 +1,3 @@
-
 #!/bin/bash
 #!/bin/bash
 
 
 #Replace the PrawnOS linux kernel that is installed on the internal emmc storage with
 #Replace the PrawnOS linux kernel that is installed on the internal emmc storage with
@@ -20,7 +19,6 @@
 # You should have received a copy of the GNU General Public License
 # You should have received a copy of the GNU General Public License
 # along with PrawnOS.  If not, see <https://www.gnu.org/licenses/>.
 # along with PrawnOS.  If not, see <https://www.gnu.org/licenses/>.
 
 
-RESOURCES=/InstallResources
 # Grab the boot device, which is either /dev/sda for usb or /dev/mmcblk0 for an sd card
 # Grab the boot device, which is either /dev/sda for usb or /dev/mmcblk0 for an sd card
 BOOT_DEVICE=$(mount | head -n 1 | cut -d '2' -f 1)
 BOOT_DEVICE=$(mount | head -n 1 | cut -d '2' -f 1)
 
 

+ 1 - 1
scripts/buildFilesystem.sh

@@ -56,7 +56,7 @@ DEBIAN_SUITE=$2
 BASE=$3
 BASE=$3
 PRAWNOS_ROOT=$4
 PRAWNOS_ROOT=$4
 
 
-outmnt=$(mktemp -d -p `pwd`)
+outmnt=$(mktemp -d -p "$(pwd)")
 
 
 outdev=/dev/loop5
 outdev=/dev/loop5
 
 

+ 2 - 2
scripts/buildInitramFs.sh

@@ -22,7 +22,7 @@ set -e
 # along with PrawnOS.  If not, see <https://www.gnu.org/licenses/>.
 # along with PrawnOS.  If not, see <https://www.gnu.org/licenses/>.
 
 
 
 
-outmnt=$(mktemp -d -p `pwd`)
+outmnt=$(mktemp -d -p "$(pwd)")
 outdev=/dev/loop7
 outdev=/dev/loop7
 if [ -z "$1" ]
 if [ -z "$1" ]
 then
 then
@@ -30,7 +30,7 @@ then
     exit 1
     exit 1
 fi
 fi
 BASE=$1
 BASE=$1
-ROOT_DIR=`pwd`
+ROOT_DIR="$(pwd)"
 build_resources=$ROOT_DIR/resources/BuildResources
 build_resources=$ROOT_DIR/resources/BuildResources
 
 
 if [ ! -f $ROOT_DIR/$BASE ]
 if [ ! -f $ROOT_DIR/$BASE ]

+ 5 - 5
scripts/buildKernel.sh

@@ -28,7 +28,7 @@ then
 fi
 fi
 
 
 KVER=$1
 KVER=$1
-ROOT_DIR=`pwd`
+ROOT_DIR="$(pwd)"
 RESOURCES=$ROOT_DIR/resources/BuildResources
 RESOURCES=$ROOT_DIR/resources/BuildResources
 
 
 [ ! -d build ] && mkdir build
 [ ! -d build ] && mkdir build
@@ -59,14 +59,14 @@ cd linux-$KVER
 make clean
 make clean
 make mrproper
 make mrproper
 #Apply the usb and mmc patches if unapplied
 #Apply the usb and mmc patches if unapplied
-[ "$FRESH" = true ] && for i in $RESOURCES/patches-tested/kernel/5.x-dwc2/*.patch; do echo $i; patch -p1 < $i; done
-[ "$FRESH" = true ] && for i in $RESOURCES/patches-tested/DTS/*.patch; do echo $i; patch -p1 < $i; done
-[ "$FRESH" = true ] && for i in $RESOURCES/patches-tested/kernel/*.patch; do echo $i; patch -p1 < $i; done
+[ "$FRESH" = true ] && for i in "$RESOURCES"/patches-tested/kernel/5.x-dwc2/*.patch; do echo $i; patch -p1 < $i; done
+[ "$FRESH" = true ] && for i in "$RESOURCES"/patches-tested/DTS/*.patch; do echo $i; patch -p1 < $i; done
+[ "$FRESH" = true ] && for i in "$RESOURCES"/patches-tested/kernel/*.patch; do echo $i; patch -p1 < $i; done
 
 
 #copy in the initramfs and kernel config
 #copy in the initramfs and kernel config
 cp $ROOT_DIR/build/PrawnOS-initramfs.cpio.gz .
 cp $ROOT_DIR/build/PrawnOS-initramfs.cpio.gz .
 cp $RESOURCES/config .config
 cp $RESOURCES/config .config
-make -j $((`nproc` +1))  CROSS_COMPILE=arm-none-eabi- ARCH=arm zImage modules dtbs
+make -j $(($(nproc) +1))  CROSS_COMPILE=arm-none-eabi- ARCH=arm zImage modules dtbs
 [ ! -h kernel.its ] && ln -s $RESOURCES/kernel.its .
 [ ! -h kernel.its ] && ln -s $RESOURCES/kernel.its .
 mkimage -D "-I dts -O dtb -p 2048" -f kernel.its vmlinux.uimg
 mkimage -D "-I dts -O dtb -p 2048" -f kernel.its vmlinux.uimg
 dd if=/dev/zero of=bootloader.bin bs=512 count=1
 dd if=/dev/zero of=bootloader.bin bs=512 count=1

+ 4 - 4
scripts/crossmenuconfig.sh

@@ -30,7 +30,7 @@ fi
 KVER=$1
 KVER=$1
 
 
 
 
-ROOT_DIR=`pwd`
+ROOT_DIR="$(pwd)"
 RESOURCES=$ROOT_DIR/resources/BuildResources
 RESOURCES=$ROOT_DIR/resources/BuildResources
 
 
 [ ! -d build ] && mkdir build
 [ ! -d build ] && mkdir build
@@ -42,9 +42,9 @@ cd linux-$KVER
 make clean
 make clean
 make mrproper
 make mrproper
 #Apply the usb and mmc patches if unapplied
 #Apply the usb and mmc patches if unapplied
-[ "$FRESH" = true ] && for i in $RESOURCES/patches-tested/kernel/5.x-dwc2/*.patch; do echo $i; patch -p1 < $i; done
-[ "$FRESH" = true ] && for i in $RESOURCES/patches-tested/DTS/*.patch; do echo $i; patch -p1 < $i; done
-[ "$FRESH" = true ] && for i in $RESOURCES/patches-tested/kernel/*.patch; do echo $i; patch -p1 < $i; done
+[ "$FRESH" = true ] && for i in "$RESOURCES"/patches-tested/kernel/5.x-dwc2/*.patch; do echo $i; patch -p1 < $i; done
+[ "$FRESH" = true ] && for i in "$RESOURCES"/patches-tested/DTS/*.patch; do echo $i; patch -p1 < $i; done
+[ "$FRESH" = true ] && for i in "$RESOURCES"/patches-tested/kernel/*.patch; do echo $i; patch -p1 < $i; done
 
 
 cp $RESOURCES/config .config
 cp $RESOURCES/config .config
 make menuconfig ARCH=arm CROSS_COMPILE=arm-none-eabi- .config
 make menuconfig ARCH=arm CROSS_COMPILE=arm-none-eabi- .config

+ 1 - 1
scripts/injectKernelIntoFS.sh

@@ -32,7 +32,7 @@ fi
 KVER=$1
 KVER=$1
 OUTNAME=$2
 OUTNAME=$2
 
 
-outmnt=$(mktemp -d -p `pwd`)
+outmnt=$(mktemp -d -p "$(pwd)")
 outdev=/dev/loop7
 outdev=/dev/loop7
 
 
 build_resources=resources/BuildResources
 build_resources=resources/BuildResources

+ 4 - 4
scripts/patchKernel.sh

@@ -10,7 +10,7 @@ then
 fi
 fi
 KVER=$1
 KVER=$1
 
 
-ROOT_DIR=`pwd`
+ROOT_DIR="$(pwd)"
 RESOURCES=$ROOT_DIR/resources/BuildResources
 RESOURCES=$ROOT_DIR/resources/BuildResources
 
 
 
 
@@ -20,8 +20,8 @@ cd build
 cd linux-$KVER
 cd linux-$KVER
 make clean
 make clean
 make mrproper
 make mrproper
-#Apply the usb and mmc patches if unapplie
-for i in $RESOURCES/patches-tested/DTS/*.patch; do patch -p1 < $i; done
-for i in $RESOURCES/patches-tested/kernel/*.patch; do patch -p1 < $i; done
+#Apply the usb and mmc patches if unapplied
+for i in "$RESOURCES"/patches-tested/DTS/*.patch; do patch -p1 < $i; done
+for i in "$RESOURCES"/patches-tested/kernel/*.patch; do patch -p1 < $i; done
 
 
 cd $ROOT_DIR
 cd $ROOT_DIR