Merge "setup_{RedHat,Debian}.sh, make more idempotent"
This commit is contained in:
commit
479862932c
@ -20,15 +20,19 @@ function add_key {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function setup_disk {
|
function setup_disk {
|
||||||
sudo swapoff -a
|
if [ ! -f /swapfile ]; then
|
||||||
sudo dd if=/dev/zero of=/swapfile bs=1M count=4096
|
sudo swapoff -a
|
||||||
sudo chmod 0600 /swapfile
|
sudo dd if=/dev/zero of=/swapfile bs=1M count=4096
|
||||||
sudo mkswap /swapfile
|
sudo chmod 0600 /swapfile
|
||||||
sudo /sbin/swapon /swapfile
|
sudo mkswap /swapfile
|
||||||
|
sudo /sbin/swapon /swapfile
|
||||||
|
fi
|
||||||
|
|
||||||
sudo dd if=/dev/zero of=/docker bs=1M count=10240
|
if [ ! -f /docker ]; then
|
||||||
losetup -f /docker
|
sudo dd if=/dev/zero of=/docker bs=1M count=10240
|
||||||
DEV=$(losetup -a | awk -F: '/\/docker/ {print $1}')
|
losetup -f /docker
|
||||||
|
DEV=$(losetup -a | awk -F: '/\/docker/ {print $1}')
|
||||||
|
fi
|
||||||
|
|
||||||
# Format Disks and setup Docker to use BTRFS
|
# Format Disks and setup Docker to use BTRFS
|
||||||
sudo parted ${DEV} -s -- mklabel msdos
|
sudo parted ${DEV} -s -- mklabel msdos
|
||||||
|
@ -4,15 +4,19 @@ set -o xtrace
|
|||||||
set -o errexit
|
set -o errexit
|
||||||
|
|
||||||
function setup_disk {
|
function setup_disk {
|
||||||
sudo swapoff -a
|
if [ ! -f /swapfile ]; then
|
||||||
sudo dd if=/dev/zero of=/swapfile bs=1M count=4096
|
sudo swapoff -a
|
||||||
sudo chmod 0600 /swapfile
|
sudo dd if=/dev/zero of=/swapfile bs=1M count=4096
|
||||||
sudo mkswap /swapfile
|
sudo chmod 0600 /swapfile
|
||||||
sudo /sbin/swapon /swapfile
|
sudo mkswap /swapfile
|
||||||
|
sudo /sbin/swapon /swapfile
|
||||||
|
fi
|
||||||
|
|
||||||
sudo dd if=/dev/zero of=/docker bs=1M count=20480
|
if [ ! -f /docker ]; then
|
||||||
losetup -f /docker
|
sudo dd if=/dev/zero of=/docker bs=1M count=20480
|
||||||
DEV=$(losetup -a | awk -F: '/\/docker/ {print $1}')
|
losetup -f /docker
|
||||||
|
DEV=$(losetup -a | awk -F: '/\/docker/ {print $1}')
|
||||||
|
fi
|
||||||
|
|
||||||
# Format Disks and setup Docker to use BTRFS
|
# Format Disks and setup Docker to use BTRFS
|
||||||
sudo parted ${DEV} -s -- mklabel msdos
|
sudo parted ${DEV} -s -- mklabel msdos
|
||||||
@ -53,7 +57,7 @@ sudo systemctl start docker
|
|||||||
sudo docker info
|
sudo docker info
|
||||||
|
|
||||||
# disable ipv6 until we're sure routes to fedora mirrors work properly
|
# 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
|
sudo /usr/sbin/sysctl -p
|
||||||
|
|
||||||
echo "Completed $0."
|
echo "Completed $0."
|
||||||
|
Loading…
Reference in New Issue
Block a user