| 
						
						
							
								
							
						
						
					 | 
				
			
			 | 
			 | 
			
				@ -27,13 +27,13 @@ source "${DIRECTORY}/api" || error "failed to source ${DIRECTORY}/api"
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  if [ -f /etc/apt/sources.list.d/Alvarito050506_mcpi-devs.list ];then
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    sudo rm -f /etc/apt/sources.list.d/Alvarito050506_mcpi-devs.list
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  fi
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  if dpkg -l box86 &>/dev/null ;then
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    sudo apt purge -y box86
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    sudo apt install -y box86-no-binfmt-restart
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  fi
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				EOF
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				) &>/dev/null &
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				if dpkg -l box86 &>/dev/null ;then
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  sudo apt purge -y box86 1&>2
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  sudo apt install -y box86-no-binfmt-restart 1>&2
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				fi
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				) &>/dev/null
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				mkdir -p "${DIRECTORY}/data/status" "${DIRECTORY}/data/update-status" "${DIRECTORY}/logs"
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				#remove week-old logfiles
 | 
			
		
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
			
			 | 
			 | 
			
				@ -72,10 +72,27 @@ if [ "$1" == 'multi-uninstall' ] || [ "$1" == 'multi-install' ];then
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    action=install
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  fi
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  failed_apps=''
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  app_list="$2" #newline-separated list of apps to install/uninstall
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  #if trying to install an already-installed app, or trying to uninstall and already-uninstalled app, ask for confirmation
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  IFS=$'\n'
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  for app in $2
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  do
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  for app in $app_list ;do
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    if [ "$(app_status "${app}")" == "${action}ed" ];then
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				      yad --text="$app is already ${action}ed. Are you sure you want to $action it again?" \
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        --text-align=center --center --title='Quick question' --window-icon="${DIRECTORY}/icons/logo.png" \
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        --button=No!"${DIRECTORY}/icons/exit.png":1 --button=Yes!"${DIRECTORY}/icons/check.png":0
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				      
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				      if [ $? != 0 ];then
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        #user clicked No, so remove the app from list
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        app_list="$(echo "$app_list" | grep -vx "$app")"
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				      fi
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    fi
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  done
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  #install/uninstall one app at a time. If it fails then add the app to the list of failed apps
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  failed_apps=''
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  for app in $app_list ;do
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    "${DIRECTORY}/manage" $action "$app"
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    if [ $? != 0 ];then
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				      #this app failed to install - add it to the list of failed apps
 | 
			
		
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
			
			 | 
			 | 
			
				@ -83,7 +100,7 @@ if [ "$1" == 'multi-uninstall' ] || [ "$1" == 'multi-install' ];then
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				$app"
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    fi
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  done
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  app_results="${app_results:1}" #remove first blank newline
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  failed_apps="${failed_apps:1}" #remove first blank newline
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  if [ "$supported" == yes ];then #if hardware and OS is supported
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    for app in $(echo "$failed_apps" | list_intersect "$(list_apps online)") ;do
 | 
			
		
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
			
			 | 
			 | 
			
				@ -116,16 +133,6 @@ elif [ "$1" == 'install' ] || [ "$1" == 'uninstall' ];then
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    error "${DIRECTORY}/apps/$app does not exist!"
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  fi
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  #display warning if hardware and os is unsupported
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  if [ "$supported" == no ];then
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    echo -e "\e[103m\e[30mWARNING: YOUR SYSTEM IS UNSUPPORTED:\n$(is_supported_system)\e[39m\e[49m"
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    sleep 1
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    echo -e "\e[103m\e[30mThe ability to send error reports has been disabled.\e[39m\e[49m"
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    sleep 1
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    echo -e "\e[103m\e[30mWaiting 10 seconds... (To cancel, press Ctrl+C or close this terminal)\e[39m\e[49m"
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    sleep 10
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  fi
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  if [ "$1" == install ];then
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    mode=install
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  else
 | 
			
		
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
			
			 | 
			 | 
			
				@ -138,11 +145,14 @@ elif [ "$1" == 'install' ] || [ "$1" == 'uninstall' ];then
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    exit 0
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  fi
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  #if already installed then ask for confirmation
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  if [ "$(app_status "${app}")" == "${mode}ed" ];then
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    yad --text="$app is already ${mode}ed. Are you sure you want to $mode it again?" \
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    --text-align=center --center --title='Quick question' --window-icon="${DIRECTORY}/icons/logo.png" \
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    --button=No!"${DIRECTORY}/icons/exit.png":1 --button=Yes!"${DIRECTORY}/icons/check.png":0 || exit 0
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  #display warning if hardware and os is unsupported
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  if [ "$supported" == no ];then
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    echo -e "\e[103m\e[30mWARNING: YOUR SYSTEM IS UNSUPPORTED:\n$(is_supported_system)\e[39m\e[49m"
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    sleep 1
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    echo -e "\e[103m\e[30mThe ability to send error reports has been disabled.\e[39m\e[49m"
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    sleep 1
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    echo -e "\e[103m\e[30mWaiting 10 seconds... (To cancel, press Ctrl+C or close this terminal)\e[39m\e[49m"
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    sleep 10
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  fi
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  #analytics
 | 
			
		
		
	
	
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
				
			
			 | 
			 | 
			
				
 
 |