diff --git a/programs/x86_64-apps b/programs/x86_64-apps index 675fc170d..fddab53df 100644 --- a/programs/x86_64-apps +++ b/programs/x86_64-apps @@ -704,6 +704,7 @@ ◆ guglielmo : A FM, DAB/DAB+ decoder using Qt and C++. ◆ guiscrcpy : GUI integration for android screen mirroring system. ◆ guitar : Graphical git client. +◆ gum : A tool for glamorous shell scripts. ◆ gvim : Edit text files. ◆ gxc-smart-contract-ide : Gxchain smart contract IDE alpha. ◆ gyroflow-appimage : Video stabilization using gyroscope data. diff --git a/programs/x86_64/gum b/programs/x86_64/gum new file mode 100644 index 000000000..ba9443edf --- /dev/null +++ b/programs/x86_64/gum @@ -0,0 +1,57 @@ +#!/bin/sh + +APP=gum +REPO="charmbracelet/gum" + +# CREATE DIRECTORIES +if [ -z "$APP" ]; then exit 1; fi +mkdir -p "/opt/$APP/tmp" && cd "/opt/$APP/tmp" || exit 1 + +# ADD THE REMOVER +echo "#!/bin/sh +rm -f /usr/share/applications/AM-$APP.desktop /usr/local/bin/$APP +rm -R -f /opt/$APP" >> "/opt/$APP/remove" +chmod a+x "/opt/$APP/remove" + +# DOWNLOAD AND PREPARE THE APP +# $version is also used for updates + +version=$(wget -q https://api.github.com/repos/"$REPO"/releases -O - | grep browser_download_url | grep -i nux_x86_64.tar.gz | cut -d '"' -f 4 | head -1) +wget "$version" -O download.tar.gz +echo "$version" >> "/opt/$APP/version" +tar fx ./*tar* && rm -f ./download.tar.gz +cd .. +mv --backup=t ./tmp/* ./ +rm -R -f ./tmp + +# LINK +ln -s "/opt/$APP/$APP" "/usr/local/bin/$APP" +chmod a+x "/opt/$APP/$APP" + +# SCRIPT TO UPDATE THE PROGRAM +cat >> /opt/$APP/AM-updater << 'EOF' +#!/bin/sh +APP=gum +REPO="charmbracelet/gum" +version0=$(cat /opt/$APP/version) +version=$(wget -q https://api.github.com/repos/"$REPO"/releases -O - | grep browser_download_url | grep -i nux_x86_64.tar.gz | cut -d '"' -f 4 | head -1) +if [ "$version" = "$version0" ]; then + echo "Update not needed!" +else + notify-send "A new version of $APP is available, please wait" + mkdir "/opt/$APP/tmp" && cd "/opt/$APP/tmp" || exit 1 + wget $version -O download.tar.gz + tar fx ./*tar*; rm -f -R ./*tar* + cd .. + mv --backup=t ./tmp/* ./ + rm ./version + echo "$version" >> ./version + rm -R -f ./tmp ./*~ + notify-send "$APP is updated!" +fi +EOF +chmod a+x "/opt/$APP/AM-updater" + +# CHANGE THE PERMISSIONS +currentuser=$(who | awk '{print $1}') +chown -R $currentuser /opt/$APP \ No newline at end of file