X-Git-Url: https://git.josue.xyz/?a=blobdiff_plain;f=gitea%2Finstall.sh;h=5726292945fdc4b0f16ed4da0515567de4978974;hb=b1d3b44f966332434d8ec49b2a0df569e9bf8c16;hp=fe6f54e2685d7e07f479667c14dc1fd7b1f5f61b;hpb=72062b452ae69a076bc562996c70aad9a16b81d6;p=webi-installers%2F.git diff --git a/gitea/install.sh b/gitea/install.sh index fe6f54e..5726292 100644 --- a/gitea/install.sh +++ b/gitea/install.sh @@ -1,19 +1,36 @@ +#!/bin/bash set -e set -u pkg_cmd_name="gitea" -WEBI_SINGLE=true +pkg_src_cmd="$HOME/.local/opt/gitea-v$WEBI_VERSION/gitea" +pkg_dst_cmd="$HOME/.local/opt/gitea/gitea" -pkg_get_current_version() { +function pkg_get_current_version() { # 'gitea version' has output in this format: # v2.1.0 h1:pQSaIJGFluFvu8KDGDODV8u4/QRED/OPyIR+MWYYse8= # This trims it down to just the version number: # 2.0.0 - echo "$(gitea --version 2>/dev/null | head -n 1 | cut -d' ' -f3)" + echo "$(gitea --version 2> /dev/null | head -n 1 | cut -d' ' -f3)" } -pkg_format_cmd_version() { - # 'gitea v2.1.0' is the canonical version format for gitea - my_version="$1" - echo "$pkg_cmd_name v$my_version" +function pkg_link() { + # although gitea is a single command it must be put in its own directory + # because it will always resolve its working path to its location, + # regardless of where it was started, where its config file lives, etc. + rm -rf "$pkg_dst_cmd" + mkdir -p "$pkg_dst_bin/custom" + chmod a+x "$pkg_src_cmd" + ln -s "$pkg_src_cmd" "$pkg_dst_cmd" +} + +# For installing from the extracted package tmp directory +function pkg_install() { + # remove the versioned folder, just in case it's there with junk + rm -rf "$pkg_src_bin" + mkdir -p "$pkg_src_bin" + + # rename the entire extracted folder to the new location + # (this will be "$HOME/.local/opt/xmpl-v$WEBI_VERSION" by default) + mv ./"$pkg_cmd_name"* "$pkg_src_cmd" }