aboutsummaryrefslogtreecommitdiff
path: root/scripts/.fonctions
diff options
context:
space:
mode:
authornemsia <nemsia@nemsia.org>2017-04-11 14:27:49 +0200
committernemsia <nemsia@nemsia.org>2017-04-11 14:27:49 +0200
commit8f906508aa797c46910dffd8f53cac207ece39b2 (patch)
treeca6b88ef303fd1991cfc5beabb8fd9bd76a34bc2 /scripts/.fonctions
parent0ab50ab5ebd65944784bea1b1af950d2a722471e (diff)
parent39b07db1b9d61211122395a6e33f39adc45472cd (diff)
downloadmastodon_ynh-8f906508aa797c46910dffd8f53cac207ece39b2.tar.gz
mastodon_ynh-8f906508aa797c46910dffd8f53cac207ece39b2.tar.bz2
mastodon_ynh-8f906508aa797c46910dffd8f53cac207ece39b2.zip
Merge remote-tracking branch 'refs/remotes/magikcypress/master'
# Conflicts: # scripts/install
Diffstat (limited to 'scripts/.fonctions')
-rw-r--r--scripts/.fonctions30
1 files changed, 30 insertions, 0 deletions
diff --git a/scripts/.fonctions b/scripts/.fonctions
index 902d62c..8abb720 100644
--- a/scripts/.fonctions
+++ b/scripts/.fonctions
@@ -89,6 +89,27 @@ FIND_PORT () { # Search free port
CHECK_VAR "$port" "port empty"
}
+SETUP_SOURCE () { # Download source, decompress and copu into $final_path
+ src=$(cat ../sources/source_md5 | awk -F' ' {'print $2'})
+ sudo wget -nv -i ../sources/source_url -O $src
+ # Checks the checksum of the downloaded source.
+ # md5sum -c ../sources/source_md5 --status || ynh_die "Corrupt source"
+ # Decompress source
+ if [ "$(echo ${src##*.})" == "tgz" ]; then
+ tar -x -f $src
+ elif [ "$(echo ${src##*.})" == "zip" ]; then
+ unzip -q $src
+ else
+ false # Unsupported archive format.
+ fi
+ # Copy file source
+ sudo cp -a $(cat ../sources/source_dir)/. "$final_path/live"
+ # Copy additional file and modified
+ if test -e "../sources/ajouts"; then
+ sudo cp -a ../sources/ajouts/. "$final_path"
+ fi
+}
+
### REMOVE SCRIPT
@@ -182,6 +203,15 @@ ynh_psql_create_db() {
}
+# Drop a role
+#
+# usage: ynh_mysql_drop_role db
+# | arg: db - the database name to drop
+ynh_psql_drop_role() {
+ sudo su -c "psql" postgres <<< \
+ "DROP ROLE ${1};"
+}
+
# Drop a database
#
# usage: ynh_mysql_drop_db db