mirror of
https://github.com/netinvent/npbackup.git
synced 2025-09-07 05:24:47 +08:00
Add permissions to restic upgrader
This commit is contained in:
parent
8eecb2d71d
commit
c67bdb9c9c
1 changed files with 11 additions and 4 deletions
|
@ -7,6 +7,7 @@ export REPO=restic
|
||||||
LATEST_VERSION=$(curl -s https://api.github.com/repos/${ORG}/${REPO}/releases/latest | grep "tag_name" | cut -d'"' -f4)
|
LATEST_VERSION=$(curl -s https://api.github.com/repos/${ORG}/${REPO}/releases/latest | grep "tag_name" | cut -d'"' -f4)
|
||||||
echo Latest restic version ${LATEST_VERSION}
|
echo Latest restic version ${LATEST_VERSION}
|
||||||
|
|
||||||
|
errors=false
|
||||||
for platform in "windows_386" "windows_amd64" "linux_arm" "linux_arm64" "linux_amd64" "darwin_amd64" "freebsd_amd64"; do
|
for platform in "windows_386" "windows_amd64" "linux_arm" "linux_arm64" "linux_amd64" "darwin_amd64" "freebsd_amd64"; do
|
||||||
restic_filename="restic_${LATEST_VERSION//v}_${platform}"
|
restic_filename="restic_${LATEST_VERSION//v}_${platform}"
|
||||||
if [ ! -f "${restic_filename}" ]; then
|
if [ ! -f "${restic_filename}" ]; then
|
||||||
|
@ -22,23 +23,29 @@ for platform in "windows_386" "windows_amd64" "linux_arm" "linux_arm64" "linux_a
|
||||||
curl -OL https://github.com/restic/restic/releases/download/${LATEST_VERSION}/restic_${LATEST_VERSION//v}_{$platform}.${ext}
|
curl -OL https://github.com/restic/restic/releases/download/${LATEST_VERSION}/restic_${LATEST_VERSION//v}_{$platform}.${ext}
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
echo "Failed to download ${restic_filename}"
|
echo "Failed to download ${restic_filename}"
|
||||||
exit 1
|
errors=true
|
||||||
else
|
else
|
||||||
if [ -f "${restic_filename}.bz2" ]; then
|
if [ -f "${restic_filename}.bz2" ]; then
|
||||||
bzip2 -d "${restic_filename}.bz2"
|
bzip2 -d "${restic_filename}.bz2"
|
||||||
|
chmod +x "${restic_filename}"
|
||||||
elif [ -f "${restic_filename}.zip" ]; then
|
elif [ -f "${restic_filename}.zip" ]; then
|
||||||
unzip "${restic_filename}.zip"
|
unzip "${restic_filename}.zip"
|
||||||
else
|
else
|
||||||
echo "Archive ${restic_filename} not found"
|
echo "Archive ${restic_filename} not found"
|
||||||
exit 1
|
errors=true
|
||||||
fi
|
fi
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
echo "Failed to decompress ${restic_filename}.bz2"
|
echo "Failed to decompress ${restic_filename}.bz2"
|
||||||
exit 1
|
errors=true
|
||||||
fi
|
fi
|
||||||
[ -f "${restic_filename}.zip" ] && rm -f "${restic_filename}.zip"
|
[ -f "${restic_filename}.zip" ] && rm -f "${restic_filename}.zip"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
if [ "${errors}" = true ]; then
|
||||||
|
echo "Errors occurred during update"
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
echo "Finished updating restic binaries"
|
echo "Finished updating restic binaries"
|
||||||
|
fi
|
||||||
|
|
Loading…
Add table
Reference in a new issue