@@ -5,63 +5,8 @@ if [ "$(id -u)" != "0" ]; then
55 exit 1
66fi
77
8- # default fallback os2borgerpc-client if no value is configured.
9- DEFAULT_OS2BORGERPC_CLIENT=https://github.com/OS2borgerPC/os2borgerpc-client.git
10-
11- # Install the configured os2borgerpc-client if it's not already installed
12- if ! pip show os2borgerpc-client > /dev/null 2>&1 ; then
13- echo " OS2borgerPC-client is not installed. Installing now..."
14-
15- # Load values from the config file
16- CONFIG_FILE=" /etc/os2borgerpc/os2borgerpc.conf"
17- PACKAGE_NAME=$( grep " ^os2borgerpc_client_package:" " $CONFIG_FILE " | cut -d' :' -f2- | xargs)
18-
19- if [ -z " $PACKAGE_NAME " ]; then
20- echo " No client package specified. Defaulting to $DEFAULT_OS2BORGERPC_CLIENT "
21- PACKAGE_NAME=" $DEFAULT_OS2BORGERPC_CLIENT "
22- fi
23-
24- # Check if PACKAGE_NAME is a GitHub URL or a PyPI package name
25- if [[ " $PACKAGE_NAME " == https://github.com/* ]]; then
26- # Parse GitHub username and repository name
27- GITHUB_USER=$( echo " $PACKAGE_NAME " | awk -F' /' ' {print $(NF-1)}' )
28- REPO_NAME=$( echo " $PACKAGE_NAME " | awk -F' /' ' {print $NF}' | sed ' s/.git$//' )
29-
30- # Fetch the latest tag from the GitHub API
31- LATEST_TAG=$( curl -s " https://api.github.com/repos/$GITHUB_USER /$REPO_NAME /tags" | jq -r ' .[0].name' )
32-
33- # Check if a tag was found and install from GitHub
34- if [ -z " $LATEST_TAG " ]; then
35- echo " No tags found for GitHub repository $GITHUB_USER /$REPO_NAME "
36- exit 1
37- else
38- echo " Latest GitHub tag for $REPO_NAME : $LATEST_TAG "
39- echo " Installing package from GitHub..."
40- pip install " git+$PACKAGE_NAME @$LATEST_TAG " > /dev/null
41-
42- # Set values in config file
43- set_os2borgerpc_config os2borgerpc_client_package " $PACKAGE_NAME "
44- set_os2borgerpc_config os2borgerpc_client_version " $LATEST_TAG "
45- fi
46- else
47- # Assume PACKAGE_NAME is a PyPI package name and fetch the latest version from PyPI
48- LATEST_VERSION=$( curl -s " https://pypi.org/pypi/$PACKAGE_NAME /json" | jq -r ' .info.version' )
49- echo " https://pypi.org/pypi/$PACKAGE_NAME /json | jq -r '.info.version'"
50-
51- # Check if a version was found and install from PyPI
52- if [ -z " $LATEST_VERSION " ]; then
53- echo " No version found for PyPI package $PACKAGE_NAME "
54- exit 1
55- else
56- echo " Latest PyPI version for $PACKAGE_NAME : $LATEST_VERSION "
57- echo " Installing package from PyPI..."
58- pip install " $PACKAGE_NAME ==$LATEST_VERSION " > /dev/null
59-
60- # Set values in config file
61- set_os2borgerpc_config os2borgerpc_client_package " $PACKAGE_NAME "
62- set_os2borgerpc_config os2borgerpc_client_version " $LATEST_VERSION "
63- fi
64- fi
65- fi
8+ # Update os2borgerpc-client
9+ /usr/local/bin/update_client.sh
6610
11+ # Register
6712/usr/local/bin/register_new_os2borgerpc_client.sh
0 commit comments