improved automatic updates via executeAndNotify to enable fire-and-forget
This commit is contained in:
		@@ -1,9 +1,20 @@
 | 
				
			|||||||
 | 
					#!/usr/bin/env bash
 | 
				
			||||||
 | 
					
 | 
				
			||||||
updateSystem() {
 | 
					updateSystem() {
 | 
				
			||||||
   noconfirm=
 | 
					   noconfirm=
 | 
				
			||||||
   if [[ $1 == "-y" ]]; then
 | 
					   if [[ $1 == "-y" ]]; then
 | 
				
			||||||
      noconfirm="-y"
 | 
					      noconfirm="--assume-yes"
 | 
				
			||||||
   fi
 | 
					   fi
 | 
				
			||||||
   sudo apt update;
 | 
					   full=
 | 
				
			||||||
   sudo apt upgrade $noconfirm;
 | 
					   if [[ $2 == "--full" ]]; then
 | 
				
			||||||
   sudo apt autoremove $noconfirm;
 | 
					      full="full-"
 | 
				
			||||||
 | 
					   fi
 | 
				
			||||||
 | 
					   executeAndNotify "doUpdateSystem $noconfirm $full" "system updated" "system update failed";
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					doUpdateSystem() {
 | 
				
			||||||
 | 
					   sudo apt update;
 | 
				
			||||||
 | 
					   sudo apt ${2}upgrade $1;
 | 
				
			||||||
 | 
					   sudo apt autoremove $1;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user