✨ add nextcloud desktop launcher
This commit is contained in:
parent
93c5d8ca6d
commit
ec2bccea4b
4 changed files with 72 additions and 7 deletions
3
bin/.icon/nextcloud.svg
Normal file
3
bin/.icon/nextcloud.svg
Normal file
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 10 KiB |
18
bin/.inc/common
Normal file
18
bin/.inc/common
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# check if a command is available
|
||||||
|
has_command() { # $command
|
||||||
|
command -v "${1}" 1>/dev/null 2>/dev/null
|
||||||
|
}
|
||||||
|
|
||||||
|
needs_commands() { # $status $cmd1 $cmd2 ...
|
||||||
|
_nc_status="${1}"
|
||||||
|
shift 1
|
||||||
|
|
||||||
|
for _nc_cmd in "${@}"; do
|
||||||
|
if ! has_command "${_nc_cmd}"; then
|
||||||
|
echo "Command '${_nc_cmd}' not available!" >&2
|
||||||
|
exit "${_nc_status}"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
45
bin/nextcloud-appimage-launch
Executable file
45
bin/nextcloud-appimage-launch
Executable file
|
|
@ -0,0 +1,45 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
INSTALL_DIR="/path/to/nextcloud-client"
|
||||||
|
|
||||||
|
# name: nextcloud-appimage-launch
|
||||||
|
# summary: Downloads and launches the latest Nextcloud (desktop) AppImage
|
||||||
|
# params: none
|
||||||
|
|
||||||
|
THISDIR="$(dirname "$(readlink -f "${0}")")"
|
||||||
|
# shellcheck disable=SC1091
|
||||||
|
. "${THISDIR}/.inc/common"
|
||||||
|
|
||||||
|
needs_commands "curl" "notify-send"
|
||||||
|
|
||||||
|
version_available="$( \
|
||||||
|
curl -sSv 'https://github.com/nextcloud-releases/desktop/releases/latest' 2>&1 \
|
||||||
|
| grep '^< location: ' \
|
||||||
|
| grep -Eo '[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+' \
|
||||||
|
| head -n1 \
|
||||||
|
)"
|
||||||
|
|
||||||
|
version_installed="$( \
|
||||||
|
readlink "${INSTALL_DIR}/current" \
|
||||||
|
| grep -Eo '[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+' \
|
||||||
|
)"
|
||||||
|
|
||||||
|
if [ -n "${version_available}" ] && [ "${version_available}" != "${version_installed}" ]; then
|
||||||
|
echo "new nextcloud version available: ${version_available}"
|
||||||
|
notify-send \
|
||||||
|
--app-name "Nextcloud" \
|
||||||
|
--icon "${THISDIR}/.icon/nextcloud.svg" \
|
||||||
|
"nextcloud-appimage-launch" \
|
||||||
|
"new nextcloud version available: ${version_available}"
|
||||||
|
|
||||||
|
curl -sSfL \
|
||||||
|
"https://github.com/nextcloud-releases/desktop/releases/download/v${version_available}/Nextcloud-${version_available}-x86_64.AppImage" \
|
||||||
|
--output "${INSTALL_DIR}/Nextcloud-${version_available}-x86_64.AppImage"
|
||||||
|
|
||||||
|
chmod +x "${INSTALL_DIR}/Nextcloud-${version_available}-x86_64.AppImage"
|
||||||
|
ln -sf "./Nextcloud-${version_available}-x86_64.AppImage" "${INSTALL_DIR}/current"
|
||||||
|
else
|
||||||
|
echo "nextcloud is up to date!"
|
||||||
|
fi
|
||||||
|
|
||||||
|
exec "${INSTALL_DIR}/current" --background "${@}"
|
||||||
|
|
@ -6,10 +6,9 @@
|
||||||
# - fully POSIX shell compliant
|
# - fully POSIX shell compliant
|
||||||
# params: none
|
# params: none
|
||||||
|
|
||||||
# check if a command is available
|
THISDIR="$(dirname "$(readlink -f "${0}")")"
|
||||||
has_command() { # $command
|
# shellcheck disable=SC1091
|
||||||
command -v "$1" 1>/dev/null 2>/dev/null
|
. "${THISDIR}/.inc/common"
|
||||||
}
|
|
||||||
|
|
||||||
# run self as root
|
# run self as root
|
||||||
if [ "$(id -u)" -ne 0 ]; then
|
if [ "$(id -u)" -ne 0 ]; then
|
||||||
|
|
@ -48,9 +47,9 @@ if has_command snap; then
|
||||||
env LANG=en_US.UTF-8 snap list --all \
|
env LANG=en_US.UTF-8 snap list --all \
|
||||||
| awk '/disabled/{print $1, $3}' \
|
| awk '/disabled/{print $1, $3}' \
|
||||||
| while read -r snap_name snap_revision; do
|
| while read -r snap_name snap_revision; do
|
||||||
set -x
|
set -x
|
||||||
snap remove "${snap_name}" --revision="${snap_revision}"
|
snap remove "${snap_name}" --revision="${snap_revision}"
|
||||||
set +x
|
set +x
|
||||||
done
|
done
|
||||||
set +ex
|
set +ex
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue