From 6985d5a551ebfe7cf1eb3bcf8ce9d6dc474e2cf6 Mon Sep 17 00:00:00 2001 From: polytan02 Date: Sat, 24 Dec 2016 13:54:11 +0000 Subject: [PATCH] Download of the sources --- scripts/install | 22 ++++++++++++++-------- scripts/upgrade | 16 +++++++++++----- 2 files changed, 25 insertions(+), 13 deletions(-) diff --git a/scripts/install b/scripts/install index fd48ed7..2df1e53 100644 --- a/scripts/install +++ b/scripts/install @@ -98,14 +98,20 @@ ynh_app_setting_set "$app" finalphpconf "$finalphpconf" # Creation of folder sudo mkdir -p $final_path -# We download the sources and check the md5sum -#cops_file=`sudo cat ../sources/source_file`; -#sudo wget -nv -i ../sources/source_url -O $cops_file -#sudo md5sum -c ../sources/source_md5 --status || (echo "Corrupt source" >&2 && false) -#sudo unzip ${cops_file} -d $final_path -#git clone $URL -#cd $PROJECT_NAME -#git reset --hard $SHA1 +# We download the sources and go to latest revision +sudo rm -rf ./gitsources +sudo mkdir gitsources +# We get the repository address +URL=`sudo cat ../sources/source_url`; +sudo git clone $URL gitsources +# We reset to the latest known revision +sudo cd gitsources +SHA1=`sudo cat ../sources/source_sha1`; +git reset --hard $SHA1 +sudo cd .. + +# We copy the sources to the destination +sudo cp -a gitsources/* $final_path # Set permissions sudo chmod 775 -R $final_path diff --git a/scripts/upgrade b/scripts/upgrade index 183e45d..8504fd3 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -31,11 +31,17 @@ finalphpconf=$(ynh_app_setting_get $app finalphpconf) sudo rm -rf $final_path sudo mkdir -p $final_path -# We download the sources and check the md5sum -#cops_file=`sudo cat ../sources/source_file`; -#sudo wget -nv -i ../sources/source_url -O $cops_file -#sudo md5sum -c ../sources/source_md5 --status || (echo "Corrupt source" >&2 && false) -#sudo unzip ${cops_file} -d $final_path +# We download the sources and go to latest revision +sudo rm -rf ./gitsources +sudo mkdir gitsources +# We get the repository address +URL=`sudo cat ../sources/source_url`; +sudo git clone $URL gitsources +# We reset to the latest known revision +sudo cd gitsources +SHA1=`sudo cat ../sources/source_sha1`; +git reset --hard $SHA1 +sudo cd .. # Set permissions sudo chmod 775 -R $final_path