mirror of
https://github.com/YunoHost/package_check.git
synced 2024-09-03 20:06:20 +02:00
fix self_upgrade
This commit is contained in:
parent
896dea99dd
commit
4382aae5bd
1 changed files with 11 additions and 15 deletions
|
@ -203,11 +203,8 @@ function self_upgrade()
|
||||||
|
|
||||||
local check_version="$(git ls-remote $git_repository | cut -f 1 | head -n1)"
|
local check_version="$(git ls-remote $git_repository | cut -f 1 | head -n1)"
|
||||||
|
|
||||||
# If the version file exist, check for an upgrade
|
|
||||||
if [ -e "$version_file" ]
|
|
||||||
then
|
|
||||||
# Check if the last commit on the repository match with the current version
|
# Check if the last commit on the repository match with the current version
|
||||||
if [ "$check_version" != "$(cat "$version_file")" ]
|
if [ ! -e "$version_file" ] || [ "$check_version" != "$(cat "$version_file")" ]
|
||||||
then
|
then
|
||||||
# If the versions don't matches. Do an upgrade
|
# If the versions don't matches. Do an upgrade
|
||||||
log_info "Upgrading Package check"
|
log_info "Upgrading Package check"
|
||||||
|
@ -219,7 +216,7 @@ function self_upgrade()
|
||||||
# Clone in another directory
|
# Clone in another directory
|
||||||
git clone --quiet $git_repository "./upgrade"
|
git clone --quiet $git_repository "./upgrade"
|
||||||
cp -a "./upgrade/." "./."
|
cp -a "./upgrade/." "./."
|
||||||
rm -r "./upgrade"
|
rm -rf "./upgrade"
|
||||||
# Update the version file
|
# Update the version file
|
||||||
echo "$check_version" > "$version_file"
|
echo "$check_version" > "$version_file"
|
||||||
rm "./pcheck.lock"
|
rm "./pcheck.lock"
|
||||||
|
@ -233,7 +230,6 @@ EOF
|
||||||
# Start the upgrade script by replacement of this process
|
# Start the upgrade script by replacement of this process
|
||||||
exec "./upgrade_script.sh"
|
exec "./upgrade_script.sh"
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
# Update the version file
|
# Update the version file
|
||||||
echo "$check_version" > "$version_file"
|
echo "$check_version" > "$version_file"
|
||||||
|
|
Loading…
Add table
Reference in a new issue