From 2e931b3b24c54ec0410c219d5a9fc0cd21f676f6 Mon Sep 17 00:00:00 2001 From: polytan02 Date: Tue, 17 Jan 2017 18:59:41 +0000 Subject: [PATCH] Update on scripts --- scripts/install | 29 +++++++++++++++++++---------- scripts/upgrade | 19 +++++++------------ 2 files changed, 26 insertions(+), 22 deletions(-) diff --git a/scripts/install b/scripts/install index 6ae6a6a..da6cf26 100644 --- a/scripts/install +++ b/scripts/install @@ -99,18 +99,27 @@ ynh_app_setting_set "$app" finalphpconf "$finalphpconf" sudo mkdir -p $final_path # We download the sources and go to latest revision -URL=`sudo cat ../sources/source_url`; -SHA1=`sudo cat ../sources/source_sha1`; -sudo rm -rf ./gitsources -sudo mkdir gitsources -sudo chmod 777 gitsources +#URL=`sudo cat ../sources/source_url`; +#SHA1=`sudo cat ../sources/source_sha1`; +#sudo rm -rf ./gitsources +#sudo mkdir gitsources +#sudo chmod 777 gitsources # We get the repository address -sudo git clone $URL gitsources +#sudo git clone $URL gitsources # We reset to the latest known revision and copy the files to final_path -cd gitsources -sudo git reset --hard $SHA1 -sudo cp -a * $final_path -cd .. +#cd gitsources +#sudo git reset --hard $SHA1 +#sudo cp -a * $final_path +#cd .. + +# We download the sources and check the md5sum +SHA1=`sudo cat ../sources/source_sha1`; +sed -i "s@SHA1TOCHANGE@$SHA1@g" ../sources/source_url +sed -i "s@SHA1TOCHANGE@$SHA1@g" ../sources/source_md5 +sudo wget -nv -i ../sources/source_url -O framagames-${SHA1}.zip +sudo md5sum -c ../sources/source_md5 --status || (echo "Corrupt source" >&2 && false) +sudo unzip framagames-${SHA1}.zip -d ../sources/ +sudo cp -a ../sources/framagames-${SHA1}/.* $final_path # Set permissions sudo chmod 775 -R $final_path diff --git a/scripts/upgrade b/scripts/upgrade index a4ac57a..f242f4a 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -31,19 +31,14 @@ finalphpconf=$(ynh_app_setting_get $app finalphpconf) sudo rm -rf $final_path sudo mkdir -p $final_path -# We download the sources and go to latest revision -URL=`sudo cat ../sources/source_url`; +# We download the sources and check the md5sum SHA1=`sudo cat ../sources/source_sha1`; -sudo rm -rf ./gitsources -sudo mkdir gitsources -sudo chmod 777 gitsources -# We get the repository address -sudo git clone $URL gitsources -# We reset to the latest known revision and copy the files to final_path -cd gitsources -sudo git reset --hard $SHA1 -sudo cp -a * $final_path -cd .. +sed -i "s@SHA1TOCHANGE@$SHA1@g" ../sources/source_url +sed -i "s@SHA1TOCHANGE@$SHA1@g" ../sources/source_md5 +sudo wget -nv -i ../sources/source_url -O framagames-${SHA1}.zip +sudo md5sum -c ../sources/source_md5 --status || (echo "Corrupt source" >&2 && false) +sudo unzip framagames-${SHA1}.zip -d ../sources/ +sudo cp -a ../sources/framagames-${SHA1}/.* $final_path # Set permissions sudo chmod 775 -R $final_path