| 
						
						
							
								
							
						
						
					 | 
				
			
			 | 
			 | 
			
				@ -3,15 +3,24 @@
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				# causes the shell to exit if any subcommand or pipeline returns a non-zero status
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				set -e
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				# The last argument is the app instance name
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				app=${!#}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				# This is a multi-instance app, meaning it can be installed several times independently
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				# The id of the app as stated in the manifest is available as $YNH_APP_ID
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				# The instance number is available as $YNH_APP_INSTANCE_NUMBER (equals "1", "2", ...)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				# The app instance name is available as $YNH_APP_INSTANCE_NAME
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				#    - the first time the app is installed, YNH_APP_INSTANCE_NAME = ynhexample
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				#    - the second time the app is installed, YNH_APP_INSTANCE_NAME = ynhexample__2
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				#    - ynhexample__{N} for the subsequent installations, with N=3,4, ...
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				# The app instance name is probably what you are interested the most, since this is
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				# guaranteed to be unique. This is a good unique identifier to define installation path,
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				# db names, ...
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				app=$YNH_APP_INSTANCE_NAME
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				# Retrieve arguments
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				domain=$1
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				path=$2
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				admin=$3
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				is_public=$4
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				language=$5
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				domain=$YNH_APP_ARG_DOMAIN
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				path=$YNH_APP_ARG_PATH
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				admin=$YNH_APP_ARG_ADMIN
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				is_public=$YNH_APP_ARG_IS_PUBLIC
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				language=$YNH_APP_ARG_LANGUAGE
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				# Save app settings
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				sudo yunohost app setting $app admin -v "$admin"
 | 
			
		
		
	
	
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
				
			
			 | 
			 | 
			
				
 
 |