Set Docker upgrade process as optional
This commit is contained in:
		@@ -1,6 +1,7 @@
 | 
			
		||||
# Containers management
 | 
			
		||||
 | 
			
		||||
These scripts and Systemd units manage the daily snapshoting of our Nspawn containers, and update of Docker containers.
 | 
			
		||||
These scripts and Systemd units manage the daily snapshoting of our Nspawn containers, and (optionally) update of Docker
 | 
			
		||||
containers.
 | 
			
		||||
 | 
			
		||||
### Introduction
 | 
			
		||||
All running Nspawn containers are stopped, snapshoted (using Btrfs subvolumes) and restarted
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										26
									
								
								install.sh
									
									
									
									
									
								
							
							
						
						
									
										26
									
								
								install.sh
									
									
									
									
									
								
							@@ -16,19 +16,23 @@ if [[ $user != 'root' ]]; then
 | 
			
		||||
  sudo cp systemd-templates/conts-snap.service /etc/systemd/system/
 | 
			
		||||
  sudo sed -i -e "s:PH_DIRECTORY:$(pwd):g" /etc/systemd/system/conts-snap.service
 | 
			
		||||
  sudo cp systemd-templates/conts-snap.timer /etc/systemd/system/
 | 
			
		||||
  sudo cp systemd-templates/docker-upgrade.service /etc/systemd/system/
 | 
			
		||||
  sudo sed -i -e "s:PH_DIRECTORY:$(pwd):g" /etc/systemd/system/docker-upgrade.service
 | 
			
		||||
  sudo cp systemd-templates/docker-upgrade.timer /etc/systemd/system/
 | 
			
		||||
  sudo cp systemd-templates/machines-start.timer /etc/systemd/system/
 | 
			
		||||
  if [ $docker -eq 1 ]; then
 | 
			
		||||
    sudo cp systemd-templates/docker-upgrade.service /etc/systemd/system/
 | 
			
		||||
    sudo sed -i -e "s:PH_DIRECTORY:$(pwd):g" /etc/systemd/system/docker-upgrade.service
 | 
			
		||||
    sudo cp systemd-templates/docker-upgrade.timer /etc/systemd/system/
 | 
			
		||||
  fi
 | 
			
		||||
else
 | 
			
		||||
  cp systemd-templates/cont-snap@.service /etc/systemd/system/
 | 
			
		||||
  cp systemd-templates/conts-snap.service /etc/systemd/system/
 | 
			
		||||
  sed -i -e "s:PH_DIRECTORY:$(pwd):g" /etc/systemd/system/conts-snap.service
 | 
			
		||||
  cp systemd-templates/conts-snap.timer /etc/systemd/system/
 | 
			
		||||
  cp systemd-templates/docker-upgrade.service /etc/systemd/system/
 | 
			
		||||
  sed -i -e "s:PH_DIRECTORY:$(pwd):g" /etc/systemd/system/docker-upgrade.service
 | 
			
		||||
  cp systemd-templates/docker-upgrade.timer /etc/systemd/system/
 | 
			
		||||
  cp systemd-templates/machines-start.timer /etc/systemd/system/
 | 
			
		||||
  if [ $docker -eq 1 ]; then
 | 
			
		||||
    cp systemd-templates/docker-upgrade.service /etc/systemd/system/
 | 
			
		||||
    sed -i -e "s:PH_DIRECTORY:$(pwd):g" /etc/systemd/system/docker-upgrade.service
 | 
			
		||||
    cp systemd-templates/docker-upgrade.timer /etc/systemd/system/
 | 
			
		||||
  fi
 | 
			
		||||
fi
 | 
			
		||||
echo "Reloading Systemd..."
 | 
			
		||||
if [[ $user != 'root' ]]; then
 | 
			
		||||
@@ -36,13 +40,17 @@ if [[ $user != 'root' ]]; then
 | 
			
		||||
else
 | 
			
		||||
  systemctl daemon-reload
 | 
			
		||||
fi
 | 
			
		||||
echo "Enabling timer (not starting it, either do it manually or reboot)..."
 | 
			
		||||
echo "Enabling timer(s) (not starting it, either do it manually or reboot)..."
 | 
			
		||||
if [[ $user != 'root' ]]; then
 | 
			
		||||
  sudo systemctl enable conts-snap.timer
 | 
			
		||||
  sudo systemctl enable docker-upgrade.timer
 | 
			
		||||
  if [ $docker -eq 1 ]; then
 | 
			
		||||
    sudo systemctl enable docker-upgrade.timer
 | 
			
		||||
  fi
 | 
			
		||||
else
 | 
			
		||||
  systemctl enable conts-snap.timer
 | 
			
		||||
  systemctl enable docker-upgrade.timer
 | 
			
		||||
  if [ $docker -eq 1 ]; then
 | 
			
		||||
    systemctl enable docker-upgrade.timer
 | 
			
		||||
  fi
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
echo "Finished install. Exiting..."
 | 
			
		||||
 
 | 
			
		||||
@@ -3,3 +3,4 @@
 | 
			
		||||
# Copy this file as variables.conf, with the correct values
 | 
			
		||||
 | 
			
		||||
containers_dir="" # Path to containers subvolumes main directory
 | 
			
		||||
docker=0 # Boolean (0 or 1); Set to 1 if Docker is running on the server
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user