Bladeren bron

[fix] Update arguments passed to the scripts

Jérôme Lebleu 9 jaren geleden
bovenliggende
commit
760163f823
5 gewijzigde bestanden met toevoegingen van 17 en 11 verwijderingen
  1. 5 5
      scripts/backup
  2. 2 1
      scripts/install
  3. 3 1
      scripts/remove
  4. 5 3
      scripts/restore
  5. 2 1
      scripts/upgrade

+ 5 - 5
scripts/backup

@@ -3,12 +3,12 @@
 # causes the shell to exit if any subcommand or pipeline returns a non-zero status
 set -e
 
-app=ynhexample
+# The last argument is the app instance name
+app=${!#}
 
-# The parameter $1 is the backup directory location
-# which will be compressed afterward
-backup_dir=$1/apps/$app
-sudo mkdir -p $backup_dir
+# The first argument is the backup directory location for the app
+# from where the script is executed and which will be compressed afterward
+backup_dir=$1
 
 # Backup sources & data
 sudo cp -a /var/www/$app/. $backup_dir/sources

+ 2 - 1
scripts/install

@@ -3,7 +3,8 @@
 # causes the shell to exit if any subcommand or pipeline returns a non-zero status
 set -e
 
-app=ynhexample
+# The last argument is the app instance name
+app=${!#}
 
 # Retrieve arguments
 domain=$1

+ 3 - 1
scripts/remove

@@ -1,5 +1,7 @@
 #!/bin/bash
-app=ynhexample
+
+# The last argument is the app instance name
+app=${!#}
 
 # Retrieve arguments
 domain=$(sudo yunohost app setting $app domain)

+ 5 - 3
scripts/restore

@@ -3,10 +3,12 @@
 # causes the shell to exit if any subcommand or pipeline returns a non-zero status
 set -e
 
-app=ynhexample
+# The last argument is the app instance name
+app=${!#}
 
-# The parameter $1 is the uncompressed restore directory location
-backup_dir=$1/apps/$app
+# The first argument is the backup directory location of the app
+# from where the script is executed
+backup_dir=$1
 
 # Restore sources & data
 sudo cp -a $backup_dir/sources/. /var/www/$app

+ 2 - 1
scripts/upgrade

@@ -3,7 +3,8 @@
 # causes the shell to exit if any subcommand or pipeline returns a non-zero status
 set -e
 
-app=ynhexample
+# The last argument is the app instance name
+app=${!#}
 
 # Retrieve arguments
 domain=$(sudo yunohost app setting $app domain)