From 5d864209bafacd6ae8177f98f628de72eea3bda5 Mon Sep 17 00:00:00 2001 From: slashtechno <77907286+slashtechno@users.noreply.github.com> Date: Sun, 23 Oct 2022 10:34:26 -0500 Subject: [PATCH 01/13] Added Go Utilizes canha/golang-tools-install-script --- apps/golang/credits | 4 ++++ apps/golang/icon-24.png | Bin 0 -> 546 bytes apps/golang/icon-64.png | Bin 0 -> 1448 bytes apps/golang/install | 4 ++++ apps/golang/uninstall | 4 ++++ apps/golang/website | 1 + 6 files changed, 13 insertions(+) create mode 100644 apps/golang/credits create mode 100644 apps/golang/icon-24.png create mode 100644 apps/golang/icon-64.png create mode 100644 apps/golang/install create mode 100644 apps/golang/uninstall create mode 100644 apps/golang/website diff --git a/apps/golang/credits b/apps/golang/credits new file mode 100644 index 0000000000..45d5f04648 --- /dev/null +++ b/apps/golang/credits @@ -0,0 +1,4 @@ +(github.com/.../...) +canha/golang-tools-install-script - the install script +golang/go - the language itself +slashtechno - addition to Pi-Apps \ No newline at end of file diff --git a/apps/golang/icon-24.png b/apps/golang/icon-24.png new file mode 100644 index 0000000000000000000000000000000000000000..18dab8e31c8d9b7531294a51639e957d227008f6 GIT binary patch literal 546 zcmV+-0^R+IP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vG?BLDy{BLR4&KXw2B0k=s+K~zXf?NUuB zgi#bd?-|ozp@fAUHADWDLKagtvZ0wt78XLWBPrP_WhE;cJ4gU`5i2Y#Eaoh}`|i2-o_p_mAF{~e|3hW$_lTTSKw}glwJf>gc@criLlav& zX@QL(1Z7l<0oD?N)%PYw{M;ZK>tb;PO66x5LS9(vCm*1~bcX!ECB$k&sQT7%J{zox z8xk);u5=q;7*qBEL~qjbFm(hj*A`N#VFuYuze33@W2f|opmHu@+l#E~fv96honQjNs(l2!*Sx}c!@=^U z?bimqHAe_luH#v4K-()wzC}5Gk%=iJ;L>%_>Xsq}WSYqpn;0aKwuDBDu}WVUOML$Z z(YT)iyJ-=bW4c9lnp1nY#TL)qYF;_ZevkQ=VikDzZaL;RwFgK(^#`mNCN0F~HApovY08PTYVckt@G+~f*R k?i~!4^AF1+i@yW#4mc%>GCO^2bN~PV07*qoM6N<$g6QJr4*&oF literal 0 HcmV?d00001 diff --git a/apps/golang/icon-64.png b/apps/golang/icon-64.png new file mode 100644 index 0000000000000000000000000000000000000000..6dc0e0ccb743682d0aa63e8fc06dd1fac03ee150 GIT binary patch literal 1448 zcmV;Z1y}lsP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vG?BLDy{BLR4&KXw2B1wBbbK~!i%?U-w9 z6jc<*|987BB8XHYN-9c`?k=_lA8mq(!JzRGLx|lXC29;LYYva`&#yGy!!;r^04bI!RlckVg& zJ+N3T7K_DVu~;k?i^XEGSk5h!+|MQovF;i;=_{ZDK|mjb6W)zEDlPe?v7&nf#`jg? zp8DfZN{h8<&Rzgwi6&O?VLCjMpS?`1E?OU9Fxt`Yyn@!qUa{t9L!uUGv_j)n)_y9> zy2Q=UJxE%7a&^KA^M<{Hvn#{Z={sl;)T%qaR%WH(M&nFu&N!b?Zsj#5@#`@Qrs8f$K!` zqcUanA{vfk-QKZq`hKEiqMPYK>s|)tbB@=)Sh>kGOy|oLlIvv?oYWJ{VmYc>Y+g)| zzUBQ_rg2OR6wWspIcN@t3TG1To^n(yITRm&SaJ!UzFf5YXne(1dk^u%TP*q!v3l7A zeR4iprtT9R*qDeQrPfmlvw;8j-WM$A6QrDv5mc|!`PzGqZF`b+cqHaXGZ1YwbKNUFwLQ#Y}Kj z&XpJ&`5rS=Dr4*1H3NabXBpXx*30P3V$pJG|8pdQC%PDfI?;#BKzssF&Y)Y z1cOi`78k9b;l#OIv>eJ2fFF2mbd^)=M}L0E?Z+gZ+jPH-#-AvfbRG?Ga7H)2l1F|qg<{s0)_iI-S( zcG)WhjTPKYat}h{$#-}?vlRn40H4NNdR~Tq2pCe~=XvdPl~Ul=HyV0c6rj3l zJ_GWpXvL#-lIMtm&Kt@T0P}Yz6`IS6uqW`)QkVlw_tN<%IV`e&b!OC_WEZ}R(rZkG z{}`Er7M$fsry4Q4zM%7l@(ckl>p5XLfrYHyEPl>=m^#MR-3sM&;#hAR9>_DZd->p( zdd~6-xTMZxkS2&#oHp};-o)ly!&BcsZbosGKLB3LF*(r7qix>_%(~`aPHUIK=0B=& zvgcBy)lsO>fiwP}Xt7u<7K_DVu~;k?i^X#80sIft+og4>T4`MX0000 Date: Sun, 23 Oct 2022 10:36:09 -0500 Subject: [PATCH 02/13] Added Go to categories --- etc/categories | 1 + 1 file changed, 1 insertion(+) diff --git a/etc/categories b/etc/categories index b38fda07a6..ca0e37c910 100644 --- a/etc/categories +++ b/etc/categories @@ -74,6 +74,7 @@ GIMP|Creative Arts Github-CLI|Programming Github Desktop|Programming Godot|Games +Go|Programming GParted|System Management Guake Terminal|Terminals Heroes 2|Games From 7186b180ad19e3a4e1cbe158a1ac31175f2482ab Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Sun, 23 Oct 2022 15:37:06 +0000 Subject: [PATCH 03/13] Correct file permissions for install and uninstall files --- apps/golang/install | 0 apps/golang/uninstall | 0 2 files changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 apps/golang/install mode change 100644 => 100755 apps/golang/uninstall diff --git a/apps/golang/install b/apps/golang/install old mode 100644 new mode 100755 diff --git a/apps/golang/uninstall b/apps/golang/uninstall old mode 100644 new mode 100755 From 3aa5a7818e3bf8b4a4c418e88c736e90db5af28c Mon Sep 17 00:00:00 2001 From: slashtechno <77907286+slashtechno@users.noreply.github.com> Date: Sun, 23 Oct 2022 12:43:09 -0500 Subject: [PATCH 04/13] Changed Go version to 1.19.2 --- apps/golang/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/golang/install b/apps/golang/install index 04946d81c8..2957dc25d8 100644 --- a/apps/golang/install +++ b/apps/golang/install @@ -1,4 +1,4 @@ #!/bin/bash # Uses the the script from the following commit: # https://github.com/canha/golang-tools-install-script/commit/258f94f6120bbf99f4c9133c9ab5826dcd359fbe -wget -q -O - https://raw.githubusercontent.com/canha/golang-tools-install-script/258f94f6120bbf99f4c9133c9ab5826dcd359fbe/goinstall.sh | bash +wget -q -O - https://raw.githubusercontent.com/canha/golang-tools-install-script/258f94f6120bbf99f4c9133c9ab5826dcd359fbe/goinstall.sh | bash -s -- --version 1.19.2 From c22cbfbcf4ece30e233cef5e4ffcccda0952afd6 Mon Sep 17 00:00:00 2001 From: slashtechno <77907286+slashtechno@users.noreply.github.com> Date: Sat, 29 Oct 2022 13:31:58 -0500 Subject: [PATCH 05/13] Get rid of unnecessary script functions --- apps/golang/install | 103 ++++++++++++++++++++++++++++++++++++++++-- apps/golang/uninstall | 55 ++++++++++++++++++++-- 2 files changed, 150 insertions(+), 8 deletions(-) diff --git a/apps/golang/install b/apps/golang/install index 2957dc25d8..12ea57d5ea 100755 --- a/apps/golang/install +++ b/apps/golang/install @@ -1,4 +1,99 @@ -#!/bin/bash -# Uses the the script from the following commit: -# https://github.com/canha/golang-tools-install-script/commit/258f94f6120bbf99f4c9133c9ab5826dcd359fbe -wget -q -O - https://raw.githubusercontent.com/canha/golang-tools-install-script/258f94f6120bbf99f4c9133c9ab5826dcd359fbe/goinstall.sh | bash -s -- --version 1.19.2 + +VERSION="1.19.2" + +[ -z "$GOROOT" ] && GOROOT="$HOME/.go" +[ -z "$GOPATH" ] && GOPATH="$HOME/go" + +OS="$(uname -s)" +ARCH="$(uname -m)" + +case $OS in + "Linux") + case $ARCH in + "aarch64") + ARCH=arm64 + ;; + "armv6" | "armv7l") + ARCH=armv6l + ;; + "armv8") + ARCH=arm64 + ;; + esac + PLATFORM="linux-$ARCH" + ;; + +esac + +if [ -z "$PLATFORM" ]; then + echo "Your operating system is not supported by the script." + exit 1 +fi + +if [ -n "$($SHELL -c 'echo $ZSH_VERSION')" ]; then + shell_profile="$HOME/.zshrc" +elif [ -n "$($SHELL -c 'echo $BASH_VERSION')" ]; then + shell_profile="$HOME/.bashrc" +elif [ -n "$($SHELL -c 'echo $FISH_VERSION')" ]; then + shell="fish" + if [ -d "$XDG_CONFIG_HOME" ]; then + shell_profile="$XDG_CONFIG_HOME/fish/config.fish" + else + shell_profile="$HOME/.config/fish/config.fish" + fi +fi + +if [ ! -z "$1" ]; then + echo "Unrecognized option: $1" + exit 1 +fi + +if [ -d "$GOROOT" ]; then + echo "The Go install directory ($GOROOT) already exists. Exiting." + exit 1 +fi + +PACKAGE_NAME="go$VERSION.$PLATFORM.tar.gz" +TEMP_DIRECTORY=$(mktemp -d) + +echo "Downloading $PACKAGE_NAME ..." +if hash wget 2>/dev/null; then + wget https://storage.googleapis.com/golang/$PACKAGE_NAME -O "$TEMP_DIRECTORY/go.tar.gz" +else + curl -o "$TEMP_DIRECTORY/go.tar.gz" https://storage.googleapis.com/golang/$PACKAGE_NAME +fi + +if [ $? -ne 0 ]; then + echo "Download failed! Exiting." + exit 1 +fi + +echo "Extracting File..." +mkdir -p "$GOROOT" + +tar -C "$GOROOT" --strip-components=1 -xzf "$TEMP_DIRECTORY/go.tar.gz" + +echo "Configuring shell profile in: $shell_profile" +touch "$shell_profile" +if [ "$shell" == "fish" ]; then + { + echo '# GoLang' + echo "set GOROOT '${GOROOT}'" + echo "set GOPATH '$GOPATH'" + echo 'set PATH $GOPATH/bin $GOROOT/bin $PATH' + } >> "$shell_profile" +else + { + echo '# GoLang' + echo "export GOROOT=${GOROOT}" + echo 'export PATH=$GOROOT/bin:$PATH' + echo "export GOPATH=$GOPATH" + echo 'export PATH=$GOPATH/bin:$PATH' + } >> "$shell_profile" +fi + +mkdir -p "${GOPATH}/"{src,pkg,bin} +echo -e "\nGo $VERSION was installed into $GOROOT.\nMake sure to relogin into your shell or run:" +echo -e "\n\tsource $shell_profile\n\nto update your environment variables." +echo "Tip: Opening a new terminal window usually just works. :)" +rm -f "$TEMP_DIRECTORY/go.tar.gz" \ No newline at end of file diff --git a/apps/golang/uninstall b/apps/golang/uninstall index 492d3dee7a..46149f6668 100755 --- a/apps/golang/uninstall +++ b/apps/golang/uninstall @@ -1,4 +1,51 @@ -#!/bin/bash -# Uses the the script from the following commit: -# https://github.com/canha/golang-tools-install-script/commit/258f94f6120bbf99f4c9133c9ab5826dcd359fbe -wget -q -O - https://raw.githubusercontent.com/canha/golang-tools-install-script/258f94f6120bbf99f4c9133c9ab5826dcd359fbe/goinstall.sh | bash -s -- --remove +OS="$(uname -s)" +ARCH="$(uname -m)" + +case $OS in + "Linux") + case $ARCH in + "aarch64") + ARCH=arm64 + ;; + "armv6" | "armv7l") + ARCH=armv6l + ;; + "armv8") + ARCH=arm64 + ;; + esac + PLATFORM="linux-$ARCH" + ;; + +esac + +rm -rf "$GOROOT" + if [ "$OS" == "Darwin" ]; then + if [ "$shell" == "fish" ]; then + sed -i "" '/# GoLang/d' "$shell_profile" + sed -i "" '/set GOROOT/d' "$shell_profile" + sed -i "" '/set GOPATH/d' "$shell_profile" + sed -i "" '/set PATH $GOPATH\/bin $GOROOT\/bin $PATH/d' "$shell_profile" + else + sed -i "" '/# GoLang/d' "$shell_profile" + sed -i "" '/export GOROOT/d' "$shell_profile" + sed -i "" '/$GOROOT\/bin/d' "$shell_profile" + sed -i "" '/export GOPATH/d' "$shell_profile" + sed -i "" '/$GOPATH\/bin/d' "$shell_profile" + fi + else + if [ "$shell" == "fish" ]; then + sed -i '/# GoLang/d' "$shell_profile" + sed -i '/set GOROOT/d' "$shell_profile" + sed -i '/set GOPATH/d' "$shell_profile" + sed -i '/set PATH $GOPATH\/bin $GOROOT\/bin $PATH/d' "$shell_profile" + else + sed -i '/# GoLang/d' "$shell_profile" + sed -i '/export GOROOT/d' "$shell_profile" + sed -i '/$GOROOT\/bin/d' "$shell_profile" + sed -i '/export GOPATH/d' "$shell_profile" + sed -i '/$GOPATH\/bin/d' "$shell_profile" + fi + fi + echo "Go removed." + exit 0 \ No newline at end of file From d4ec0bfe615c0ea91c23260caab58e3cd1c792c2 Mon Sep 17 00:00:00 2001 From: slashtechno <77907286+slashtechno@users.noreply.github.com> Date: Thu, 3 Nov 2022 18:55:08 -0500 Subject: [PATCH 06/13] Use existing `arch` var for install --- apps/golang/install | 30 +++++++++++------------------- 1 file changed, 11 insertions(+), 19 deletions(-) diff --git a/apps/golang/install b/apps/golang/install index 12ea57d5ea..5b21b9c62d 100755 --- a/apps/golang/install +++ b/apps/golang/install @@ -4,26 +4,18 @@ VERSION="1.19.2" [ -z "$GOROOT" ] && GOROOT="$HOME/.go" [ -z "$GOPATH" ] && GOPATH="$HOME/go" -OS="$(uname -s)" -ARCH="$(uname -m)" - -case $OS in - "Linux") - case $ARCH in - "aarch64") - ARCH=arm64 - ;; - "armv6" | "armv7l") - ARCH=armv6l - ;; - "armv8") - ARCH=arm64 - ;; - esac - PLATFORM="linux-$ARCH" +case "$arch" in + "64") + ARCH="arm64" ;; - -esac + "32") + ARCH="armv6l" + ;; + *) + error "arch variable is not set, can not continue" + PLATFORM="linux-$ARCH" + ;; + esac if [ -z "$PLATFORM" ]; then echo "Your operating system is not supported by the script." From b8d7f978380379edf56856517411790d3bbd1cf7 Mon Sep 17 00:00:00 2001 From: slashtechno <77907286+slashtechno@users.noreply.github.com> Date: Thu, 3 Nov 2022 19:14:10 -0500 Subject: [PATCH 07/13] Cleaned up code --- apps/golang/install | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/apps/golang/install b/apps/golang/install index 5b21b9c62d..c3f351a065 100755 --- a/apps/golang/install +++ b/apps/golang/install @@ -6,14 +6,13 @@ VERSION="1.19.2" case "$arch" in "64") - ARCH="arm64" + PLATFORM="linux-arm64" ;; "32") - ARCH="armv6l" + PLATFORM="linux-armv6l" ;; *) error "arch variable is not set, can not continue" - PLATFORM="linux-$ARCH" ;; esac From cf6e56e4d2b4af207691346560b9fcdc6a854035 Mon Sep 17 00:00:00 2001 From: slashtechno <77907286+slashtechno@users.noreply.github.com> Date: Fri, 4 Nov 2022 01:03:50 -0500 Subject: [PATCH 08/13] Fixed more miscellaneous issues in install script --- apps/golang/credits | 2 +- apps/golang/install | 4 ++-- apps/golang/uninstall | 22 +--------------------- 3 files changed, 4 insertions(+), 24 deletions(-) diff --git a/apps/golang/credits b/apps/golang/credits index 45d5f04648..048c2206ff 100644 --- a/apps/golang/credits +++ b/apps/golang/credits @@ -1,4 +1,4 @@ (github.com/.../...) -canha/golang-tools-install-script - the install script +canha/golang-tools-install-scrip t - the install script golang/go - the language itself slashtechno - addition to Pi-Apps \ No newline at end of file diff --git a/apps/golang/install b/apps/golang/install index c3f351a065..280ed8714f 100755 --- a/apps/golang/install +++ b/apps/golang/install @@ -1,4 +1,4 @@ - +#!/bin/bash VERSION="1.19.2" [ -z "$GOROOT" ] && GOROOT="$HOME/.go" @@ -14,7 +14,7 @@ case "$arch" in *) error "arch variable is not set, can not continue" ;; - esac +esac if [ -z "$PLATFORM" ]; then echo "Your operating system is not supported by the script." diff --git a/apps/golang/uninstall b/apps/golang/uninstall index 46149f6668..9b2bd4e4a0 100755 --- a/apps/golang/uninstall +++ b/apps/golang/uninstall @@ -1,24 +1,4 @@ -OS="$(uname -s)" -ARCH="$(uname -m)" - -case $OS in - "Linux") - case $ARCH in - "aarch64") - ARCH=arm64 - ;; - "armv6" | "armv7l") - ARCH=armv6l - ;; - "armv8") - ARCH=arm64 - ;; - esac - PLATFORM="linux-$ARCH" - ;; - -esac - +#!/bin/bash rm -rf "$GOROOT" if [ "$OS" == "Darwin" ]; then if [ "$shell" == "fish" ]; then From 8e5055afc7d9f1aa0188a06b46ccac6d8a23e2c2 Mon Sep 17 00:00:00 2001 From: slashtechno <77907286+slashtechno@users.noreply.github.com> Date: Sat, 5 Nov 2022 03:01:16 -0500 Subject: [PATCH 09/13] Get rid of MacOS-specific code in uninstall --- apps/golang/uninstall | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/apps/golang/uninstall b/apps/golang/uninstall index 9b2bd4e4a0..24db9e4e4b 100755 --- a/apps/golang/uninstall +++ b/apps/golang/uninstall @@ -1,19 +1,5 @@ #!/bin/bash rm -rf "$GOROOT" - if [ "$OS" == "Darwin" ]; then - if [ "$shell" == "fish" ]; then - sed -i "" '/# GoLang/d' "$shell_profile" - sed -i "" '/set GOROOT/d' "$shell_profile" - sed -i "" '/set GOPATH/d' "$shell_profile" - sed -i "" '/set PATH $GOPATH\/bin $GOROOT\/bin $PATH/d' "$shell_profile" - else - sed -i "" '/# GoLang/d' "$shell_profile" - sed -i "" '/export GOROOT/d' "$shell_profile" - sed -i "" '/$GOROOT\/bin/d' "$shell_profile" - sed -i "" '/export GOPATH/d' "$shell_profile" - sed -i "" '/$GOPATH\/bin/d' "$shell_profile" - fi - else if [ "$shell" == "fish" ]; then sed -i '/# GoLang/d' "$shell_profile" sed -i '/set GOROOT/d' "$shell_profile" @@ -26,6 +12,5 @@ rm -rf "$GOROOT" sed -i '/export GOPATH/d' "$shell_profile" sed -i '/$GOPATH\/bin/d' "$shell_profile" fi - fi echo "Go removed." exit 0 \ No newline at end of file From a52718a0adbc844d04ad3473fa56ad5c8b754ebc Mon Sep 17 00:00:00 2001 From: slashtechno <77907286+slashtechno@users.noreply.github.com> Date: Fri, 4 Nov 2022 23:55:47 -0500 Subject: [PATCH 10/13] Fixed `$shell_profile` in uninstall script --- apps/golang/uninstall | 40 ++++++++++++++++++++++++++-------------- 1 file changed, 26 insertions(+), 14 deletions(-) diff --git a/apps/golang/uninstall b/apps/golang/uninstall index 24db9e4e4b..6ab117aeb9 100755 --- a/apps/golang/uninstall +++ b/apps/golang/uninstall @@ -1,16 +1,28 @@ #!/bin/bash +if [ -n "$($SHELL -c 'echo $ZSH_VERSION')" ]; then + shell_profile="$HOME/.zshrc" +elif [ -n "$($SHELL -c 'echo $BASH_VERSION')" ]; then + shell_profile="$HOME/.bashrc" +elif [ -n "$($SHELL -c 'echo $FISH_VERSION')" ]; then + shell="fish" + if [ -d "$XDG_CONFIG_HOME" ]; then + shell_profile="$XDG_CONFIG_HOME/fish/config.fish" + else + shell_profile="$HOME/.config/fish/config.fish" + fi +fi rm -rf "$GOROOT" - if [ "$shell" == "fish" ]; then - sed -i '/# GoLang/d' "$shell_profile" - sed -i '/set GOROOT/d' "$shell_profile" - sed -i '/set GOPATH/d' "$shell_profile" - sed -i '/set PATH $GOPATH\/bin $GOROOT\/bin $PATH/d' "$shell_profile" - else - sed -i '/# GoLang/d' "$shell_profile" - sed -i '/export GOROOT/d' "$shell_profile" - sed -i '/$GOROOT\/bin/d' "$shell_profile" - sed -i '/export GOPATH/d' "$shell_profile" - sed -i '/$GOPATH\/bin/d' "$shell_profile" - fi - echo "Go removed." - exit 0 \ No newline at end of file + if [ "$shell" == "fish" ]; then + sed -i '/# GoLang/d' "$shell_profile" + sed -i '/set GOROOT/d' "$shell_profile" + sed -i '/set GOPATH/d' "$shell_profile" + sed -i '/set PATH $GOPATH\/bin $GOROOT\/bin $PATH/d' "$shell_profile" + else + sed -i '/# GoLang/d' "$shell_profile" + sed -i '/export GOROOT/d' "$shell_profile" + sed -i '/$GOROOT\/bin/d' "$shell_profile" + sed -i '/export GOPATH/d' "$shell_profile" + sed -i '/$GOPATH\/bin/d' "$shell_profile" + fi +echo "Go removed." +exit 0 \ No newline at end of file From 062ad95fa31a3334cec52cd25fd2cfe32cba5c0c Mon Sep 17 00:00:00 2001 From: slashtechno <77907286+slashtechno@users.noreply.github.com> Date: Sun, 6 Nov 2022 01:22:08 -0500 Subject: [PATCH 11/13] Rename `$VERSION` to `$version` --- apps/golang/install | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/apps/golang/install b/apps/golang/install index 280ed8714f..8f62b755aa 100755 --- a/apps/golang/install +++ b/apps/golang/install @@ -1,5 +1,4 @@ #!/bin/bash -VERSION="1.19.2" [ -z "$GOROOT" ] && GOROOT="$HOME/.go" [ -z "$GOPATH" ] && GOPATH="$HOME/go" @@ -44,7 +43,7 @@ if [ -d "$GOROOT" ]; then exit 1 fi -PACKAGE_NAME="go$VERSION.$PLATFORM.tar.gz" +PACKAGE_NAME="go$version.$PLATFORM.tar.gz" TEMP_DIRECTORY=$(mktemp -d) echo "Downloading $PACKAGE_NAME ..." @@ -84,7 +83,7 @@ else fi mkdir -p "${GOPATH}/"{src,pkg,bin} -echo -e "\nGo $VERSION was installed into $GOROOT.\nMake sure to relogin into your shell or run:" +echo -e "\nGo $version was installed into $GOROOT.\nMake sure to relogin into your shell or run:" echo -e "\n\tsource $shell_profile\n\nto update your environment variables." echo "Tip: Opening a new terminal window usually just works. :)" rm -f "$TEMP_DIRECTORY/go.tar.gz" \ No newline at end of file From 67154f0b113c58007997fc6ca9c1dfa9067d9c41 Mon Sep 17 00:00:00 2001 From: slashtechno <77907286+slashtechno@users.noreply.github.com> Date: Sun, 6 Nov 2022 01:23:23 -0500 Subject: [PATCH 12/13] Removed unintentional whitespace in credits --- apps/golang/credits | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/golang/credits b/apps/golang/credits index 048c2206ff..45d5f04648 100644 --- a/apps/golang/credits +++ b/apps/golang/credits @@ -1,4 +1,4 @@ (github.com/.../...) -canha/golang-tools-install-scrip t - the install script +canha/golang-tools-install-script - the install script golang/go - the language itself slashtechno - addition to Pi-Apps \ No newline at end of file From 4aa892155c9c2a86e22cab5c1c606efeac9b33a3 Mon Sep 17 00:00:00 2001 From: slashtechno <77907286+slashtechno@users.noreply.github.com> Date: Sat, 5 Nov 2022 21:34:01 -0500 Subject: [PATCH 13/13] Added error checking, fixed variables --- apps/golang/install | 9 +++------ apps/golang/uninstall | 2 ++ 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/apps/golang/install b/apps/golang/install index 8f62b755aa..7fb445e0f7 100755 --- a/apps/golang/install +++ b/apps/golang/install @@ -1,4 +1,5 @@ #!/bin/bash +version=1.19.3 [ -z "$GOROOT" ] && GOROOT="$HOME/.go" [ -z "$GOPATH" ] && GOPATH="$HOME/go" @@ -47,11 +48,7 @@ PACKAGE_NAME="go$version.$PLATFORM.tar.gz" TEMP_DIRECTORY=$(mktemp -d) echo "Downloading $PACKAGE_NAME ..." -if hash wget 2>/dev/null; then - wget https://storage.googleapis.com/golang/$PACKAGE_NAME -O "$TEMP_DIRECTORY/go.tar.gz" -else - curl -o "$TEMP_DIRECTORY/go.tar.gz" https://storage.googleapis.com/golang/$PACKAGE_NAME -fi +wget https://storage.googleapis.com/golang/$PACKAGE_NAME -O "$TEMP_DIRECTORY/go.tar.gz" || error "Failed to download" if [ $? -ne 0 ]; then echo "Download failed! Exiting." @@ -61,7 +58,7 @@ fi echo "Extracting File..." mkdir -p "$GOROOT" -tar -C "$GOROOT" --strip-components=1 -xzf "$TEMP_DIRECTORY/go.tar.gz" +tar -C "$GOROOT" --strip-components=1 -xzf "$TEMP_DIRECTORY/go.tar.gz" || error "Failed to extract" echo "Configuring shell profile in: $shell_profile" touch "$shell_profile" diff --git a/apps/golang/uninstall b/apps/golang/uninstall index 6ab117aeb9..4da46b8930 100755 --- a/apps/golang/uninstall +++ b/apps/golang/uninstall @@ -1,4 +1,6 @@ #!/bin/bash +[ -z "$GOROOT" ] && GOROOT="$HOME/.go" + if [ -n "$($SHELL -c 'echo $ZSH_VERSION')" ]; then shell_profile="$HOME/.zshrc" elif [ -n "$($SHELL -c 'echo $BASH_VERSION')" ]; then