Browse Source

fix swapon for "0"

Your Name 7 years ago
parent
commit
aeaf426ae2
1 changed files with 9 additions and 5 deletions
  1. 9 5
      setup.sh

+ 9 - 5
setup.sh

@@ -1,7 +1,7 @@
 #!/bin/bash
 set -e
-script_version="1.42"
-rdate="09/04/2018"
+script_version="1.43"
+rdate="01/07/2018"
 remote_folder="http://wareck.free.fr/openrig"
 amd_driver_v="18.20-606296"
 
@@ -13,7 +13,7 @@ SGMINER="YES"
 SGMINER_TT="YES"
 Lyra2z="YES"
 
-swap_size="16" # 0/4/8/16 Go
+swap_size="0" # 0/4/8/16 Go
 
 #script_version=`grep version version.txt | awk '{ print $2 }'`
 #rdate=`grep release version.txt | awk '{ print $2 }'`
@@ -328,17 +328,21 @@ case $swap_size in
 16) sudo dd if=/dev/zero | pv -s 16G | dd of=/swapfile iflag=fullblock bs=1024 count=16777216 ;;
 *) echo -e "\e[91mError in configuration !\e[0m" && exit ;;
 esac
+if ! [ $swap_size = "0" ]
+then
 sudo mkswap /swapfile
 sudo swapon /swapfile
 sudo cat <<'EOF'>> /etc/fstab
 /swapfile       none    swap    sw      0       0
 EOF
+sudo chmod 600 /swapfile
+sudo touch /forcefsck
+fi
 else
         echo -e "\e[93mSwapfile already enabled... \e[0m"
         echo -e "\e[93mCheck /etc/fsatb file.\e[0m\n"
 fi
-sudo chmod 600 /swapfile
-sudo touch /forcefsck
+
 echo -e "\e[97mDone !\e[0m"
 
 sudo usermod -a -G video work