diff --git a/tools/setup_Debian.sh b/tools/setup_Debian.sh index 0855c89a79..33fa8b16db 100755 --- a/tools/setup_Debian.sh +++ b/tools/setup_Debian.sh @@ -20,15 +20,19 @@ function add_key { } function setup_disk { - sudo swapoff -a - sudo dd if=/dev/zero of=/swapfile bs=1M count=4096 - sudo chmod 0600 /swapfile - sudo mkswap /swapfile - sudo /sbin/swapon /swapfile + if [ ! -f /swapfile ]; then + sudo swapoff -a + sudo dd if=/dev/zero of=/swapfile bs=1M count=4096 + sudo chmod 0600 /swapfile + sudo mkswap /swapfile + sudo /sbin/swapon /swapfile + fi - sudo dd if=/dev/zero of=/docker bs=1M count=10240 - losetup -f /docker - DEV=$(losetup -a | awk -F: '/\/docker/ {print $1}') + if [ ! -f /docker ]; then + sudo dd if=/dev/zero of=/docker bs=1M count=10240 + losetup -f /docker + DEV=$(losetup -a | awk -F: '/\/docker/ {print $1}') + fi # Format Disks and setup Docker to use BTRFS sudo parted ${DEV} -s -- mklabel msdos diff --git a/tools/setup_RedHat.sh b/tools/setup_RedHat.sh index a062768b81..be4b3ec325 100755 --- a/tools/setup_RedHat.sh +++ b/tools/setup_RedHat.sh @@ -4,15 +4,19 @@ set -o xtrace set -o errexit function setup_disk { - sudo swapoff -a - sudo dd if=/dev/zero of=/swapfile bs=1M count=4096 - sudo chmod 0600 /swapfile - sudo mkswap /swapfile - sudo /sbin/swapon /swapfile + if [ ! -f /swapfile ]; then + sudo swapoff -a + sudo dd if=/dev/zero of=/swapfile bs=1M count=4096 + sudo chmod 0600 /swapfile + sudo mkswap /swapfile + sudo /sbin/swapon /swapfile + fi - sudo dd if=/dev/zero of=/docker bs=1M count=20480 - losetup -f /docker - DEV=$(losetup -a | awk -F: '/\/docker/ {print $1}') + if [ ! -f /docker ]; then + sudo dd if=/dev/zero of=/docker bs=1M count=20480 + losetup -f /docker + DEV=$(losetup -a | awk -F: '/\/docker/ {print $1}') + fi # Format Disks and setup Docker to use BTRFS sudo parted ${DEV} -s -- mklabel msdos @@ -53,7 +57,7 @@ sudo systemctl start docker sudo docker info # disable ipv6 until we're sure routes to fedora mirrors work properly -sudo sh -c 'echo "net.ipv6.conf.all.disable_ipv6 = 1" >> /etc/sysctl.conf' +sudo sh -c 'echo "net.ipv6.conf.all.disable_ipv6 = 1" > /etc/sysctl.d/disable_ipv6.conf' sudo /usr/sbin/sysctl -p echo "Completed $0."