From 88aec6046929c0b5492c3eb845bff7d582e9b861 Mon Sep 17 00:00:00 2001 From: MichaIng Date: Sun, 30 Jan 2022 20:59:46 +0100 Subject: [PATCH 1/4] v8.1 - DietPi-Software | OpenBazaar: Switch to fork and do not install Go when a pre-compiled binary is used - DietPi-Software | Check for directories before creating them, also use "-p" flag only when required for parent directories or when we create multiple dirs with one call and do not want to check for each separately --- dietpi/dietpi-software | 90 +++++++++++++++++++----------------------- 1 file changed, 40 insertions(+), 50 deletions(-) diff --git a/dietpi/dietpi-software b/dietpi/dietpi-software index 97fd1ea261..93cd081e7a 100755 --- a/dietpi/dietpi-software +++ b/dietpi/dietpi-software @@ -1060,8 +1060,8 @@ INDEX_BROWSER=$INDEX_BROWSER" aSOFTWARE_DESC[$software_id]='decentralised peer to peer bitcoin market' aSOFTWARE_CATX[$software_id]=6 aSOFTWARE_DOCS[$software_id]='https://dietpi.com/docs/software/social/#openbazaar' - aSOFTWARE_DEPS[$software_id]='188' - (( $G_HW_ARCH == 10 )) || aSOFTWARE_DEPS[$software_id]+=' 16' + # x86_64 uses pre-compiled binaries, ARM requires Go for compiling + (( $G_HW_ARCH == 10 )) || aSOFTWARE_DEPS[$software_id]+=' 16 188' aSOFTWARE_INTERACTIVE[$software_id]=1 #------------------ software_id=125 @@ -2951,7 +2951,7 @@ _EOF_ else - G_EXEC mkdir -p /mnt/dietpi_userdata/postgresql + G_EXEC mkdir /mnt/dietpi_userdata/postgresql fi @@ -4340,8 +4340,8 @@ _EOF_ # x86_64: Download pre-compiled binary if (( $G_HW_ARCH == 10 )) then - local fallback_url='https://github.com/OpenBazaar/openbazaar-go/releases/download/v0.14.6/openbazaar-go-linux-amd64' - Download_Install "$(curl -sSfL 'https://api.github.com/repos/OpenBazaar/openbazaar-go/releases/latest' | mawk -F\" '/"browser_download_url": ".*\/openbazaar-go-linux-amd64"/{print $4}')" + local fallback_url='https://github.com/mobazha/openbazaar-desktop/releases/download/v2.4.12/openbazaar-go-linux-amd64' + Download_Install "$(curl -sSfL 'https://api.github.com/repos/mobazha/openbazaar-desktop/releases/latest' | mawk -F\" '/"browser_download_url": ".*\/openbazaar-go-linux-amd64"/{print $4}')" command -v strip > /dev/null && G_EXEC strip --remove-section=.comment --remove-section=.note openbazaar-go-linux-amd64 G_EXEC mv openbazaar-go-linux-amd64 /usr/local/bin/openbazaar-go G_EXEC chmod +x /usr/local/bin/openbazaar-go @@ -4351,17 +4351,17 @@ _EOF_ # OpenBazaar cannot be installed in module mode yet: https://github.com/OpenBazaar/openbazaar-go/issues/2072 # Build it in legacy mode in tmpfs and move only binary in place G_EXEC cd "$G_WORKING_DIR" # Failsafe - GO111MODULE=off GOPATH=$PWD HOME=$PWD G_EXEC_OUTPUT=1 G_EXEC go get -v github.com/OpenBazaar/openbazaar-go + GO111MODULE=off GOPATH=$PWD HOME=$PWD G_EXEC_OUTPUT=1 G_EXEC go get -v github.com/mobazha/openbazaar-go G_EXEC strip --remove-section=.comment --remove-section=.note bin/openbazaar-go G_EXEC mv bin/openbazaar-go /usr/local/bin/openbazaar-go G_EXEC_NOHALT=1 G_EXEC rm -Rf .cache src bin fi # Init OpenBazaar to have config file available, if not yet the case, and edit to allow remote client access - if [[ ! -f '/mnt/dietpi_userdata/openbazaar/config' ]]; then - + if [[ ! -f '/mnt/dietpi_userdata/openbazaar/config' ]] + then # Data dir - G_EXEC mkdir -p /mnt/dietpi_userdata/openbazaar + [[ -d '/mnt/dietpi_userdata/openbazaar' ]] || G_EXEC mkdir /mnt/dietpi_userdata/openbazaar G_EXEC_OUTPUT=1 G_EXEC openbazaar-go init -d /mnt/dietpi_userdata/openbazaar @@ -4373,28 +4373,21 @@ _EOF_ G_EXEC_OUTPUT=1 G_EXEC openbazaar-go setapicreds -d /mnt/dietpi_userdata/openbazaar # Client IP needs to be added to allowed IP list - local ob_client_ip= - local invalid_entry= + local ob_client_ip='' invalid_entry='' while : do if G_WHIP_INPUTBOX "${invalid_entry}Please enter the IPv4 address of your ${aSOFTWARE_NAME[$software_id]} client machine. -\nThis is required, since the ${aSOFTWARE_NAME[$software_id]} server node by default does not allow any remote connection." && [[ $G_WHIP_RETURNED_VALUE =~ ^[0-9]+'.'[0-9]+'.'[0-9]+'.'[0-9]+$ ]]; then - +\nThis is required, since the ${aSOFTWARE_NAME[$software_id]} server node by default does not allow any remote connection." && [[ $G_WHIP_RETURNED_VALUE =~ ^[0-9]+'.'[0-9]+'.'[0-9]+'.'[0-9]+$ ]] + then ob_client_ip=$G_WHIP_RETURNED_VALUE break - else - invalid_entry='[FAILED] Please enter a valid IPv4 address.\n\n' - fi done G_CONFIG_INJECT '"AllowedIPs":' " \"AllowedIPs\": [\"$ob_client_ip\"]," /mnt/dietpi_userdata/openbazaar/config - else - G_DIETPI-NOTIFY 2 "Existing ${aSOFTWARE_NAME[$software_id]} config found. Skipping pre-configuration..." - fi # User @@ -4553,7 +4546,7 @@ _EOF_ # Prepare our new config + data directory if not yet present if [[ ! -f '/mnt/dietpi_userdata/fahclient/config.xml' ]]; then - G_EXEC mkdir -p /mnt/dietpi_userdata/fahclient + [[ -d '/mnt/dietpi_userdata/fahclient' ]] || G_EXEC mkdir /mnt/dietpi_userdata/fahclient dps_index=$software_id Download_Install 'config.xml' /mnt/dietpi_userdata/fahclient/config.xml fi @@ -5456,12 +5449,12 @@ _EOF_ then G_EXEC mv /var/lib/mopidy /mnt/dietpi_userdata/mopidy # Workaround error about moving data dir into itself - G_EXEC mkdir -p /mnt/dietpi_userdata/mopidy/.hidden_data + [[ -d '/mnt/dietpi_userdata/mopidy/.hidden_data' ]] || G_EXEC mkdir /mnt/dietpi_userdata/mopidy/.hidden_data # Non-hidden files/folders are data G_EXEC mv /mnt/dietpi_userdata/mopidy/* /mnt/dietpi_userdata/mopidy/.hidden_data G_EXEC mv /mnt/dietpi_userdata/mopidy/.hidden_data /mnt/dietpi_userdata/mopidy/data else - G_EXEC mkdir -p /mnt/dietpi_userdata/mopidy/data + [[ -d '/mnt/dietpi_userdata/mopidy/data' ]] || G_EXEC mkdir -p /mnt/dietpi_userdata/mopidy/data [[ -d '/var/lib/mopidy' ]] && G_EXEC rm -R /var/lib/mopidy fi @@ -5470,7 +5463,7 @@ _EOF_ then G_EXEC mv /var/cache/mopidy /mnt/dietpi_userdata/mopidy/cache else - G_EXEC mkdir -p /mnt/dietpi_userdata/mopidy/cache + [[ -d '/mnt/dietpi_userdata/mopidy/cache' ]] || G_EXEC mkdir /mnt/dietpi_userdata/mopidy/cache [[ -d '/var/cache/mopidy' ]] && G_EXEC rm -R /var/cache/mopidy fi @@ -5672,7 +5665,7 @@ _EOF_ dps_index=$software_id Download_Install 'minidlna.conf' /etc/minidlna.conf # Cache - G_EXEC mkdir -p /mnt/dietpi_userdata/.MiniDLNA_Cache + [[ -d '/mnt/dietpi_userdata/.MiniDLNA_Cache' ]] || G_EXEC mkdir /mnt/dietpi_userdata/.MiniDLNA_Cache G_EXEC chown -R minidlna:root /mnt/dietpi_userdata/.MiniDLNA_Cache Download_Test_Media @@ -5921,7 +5914,7 @@ _EOF_ fi # Setup data directory - G_EXEC mkdir -p /mnt/dietpi_userdata/rpicam + [[ -d '/mnt/dietpi_userdata/rpicam' ]] || G_EXEC mkdir /mnt/dietpi_userdata/rpicam G_EXEC rm -Rf /var/www/rpicam/media G_EXEC ln -s /mnt/dietpi_userdata/rpicam /var/www/rpicam/media @@ -7834,7 +7827,7 @@ _EOF_ else - G_EXEC mkdir -p /mnt/dietpi_userdata/grafana + G_EXEC mkdir /mnt/dietpi_userdata/grafana G_EXEC chown -R grafana:grafana /mnt/dietpi_userdata/grafana fi @@ -7877,7 +7870,7 @@ _EOF_ G_EXEC curl -sSfL 'https://vaemendis.net/ubooquity/service/download.php' -o Ubooquity.zip G_EXEC unzip -o Ubooquity.zip G_EXEC_NOHALT=1 G_EXEC rm Ubooquity.zip - G_EXEC mkdir -p /mnt/dietpi_userdata/ubooquity + [[ -d '/mnt/dietpi_userdata/ubooquity' ]] || G_EXEC mkdir /mnt/dietpi_userdata/ubooquity G_EXEC mv {,/mnt/dietpi_userdata/ubooquity/}Ubooquity.jar # User @@ -9177,7 +9170,7 @@ _EOF_ Create_User -d /etc/gogs gogs # Directories + permissions - G_EXEC mkdir -p /mnt/dietpi_userdata/gogs-repo + [[ -d '/mnt/dietpi_userdata/gogs-repo' ]] || G_EXEC mkdir /mnt/dietpi_userdata/gogs-repo G_EXEC chown -R gogs:gogs /etc/gogs /mnt/dietpi_userdata/gogs-repo # Database @@ -9455,7 +9448,7 @@ _EOF_ G_CONFIG_INJECT '"curl"[[:blank:]]' ' "curl" => "/usr/bin/curl",' /var/www/rutorrent/conf/config.php # Session dir - G_EXEC mkdir -p /mnt/dietpi_userdata/downloads/.session + [[ -d '/mnt/dietpi_userdata/downloads/.session' ]] || G_EXEC mkdir /mnt/dietpi_userdata/downloads/.session # User Create_User -g dietpi -d /mnt/dietpi_userdata/rtorrent rtorrent @@ -9568,7 +9561,7 @@ _EOF_ Create_User -g dietpi -d /mnt/dietpi_userdata/aria2 aria2 # Config - G_EXEC mkdir -p /mnt/dietpi_userdata/aria2 + [[ -d '/mnt/dietpi_userdata/aria2' ]] || G_EXEC mkdir /mnt/dietpi_userdata/aria2 [[ -f '/mnt/dietpi_userdata/aria2/aria2.conf' ]] || cat << _EOF_ > /mnt/dietpi_userdata/aria2/aria2.conf # DietPi default aria2c options served as aria2.conf file via --conf-path # https://aria2.github.io/manual/en/html/aria2c.html#options @@ -9739,7 +9732,7 @@ _EOF_ G_EXEC sed -i '\|:8384|c\
0.0.0.0:8384
' /mnt/dietpi_userdata/syncthing/config.xml # Set default data directory - G_EXEC mkdir -p /mnt/dietpi_userdata/syncthing_data + [[ -d '/mnt/dietpi_userdata/syncthing_data' ]] || G_EXEC mkdir /mnt/dietpi_userdata/syncthing_data G_EXEC chown -R dietpi:dietpi /mnt/dietpi_userdata/syncthing_data sed -i '\| /etc/systemd/system/tautulli.service @@ -10995,7 +10988,7 @@ _EOF_ Banner_Installing G_EXEC curl -sSfL 'https://nzbget.net/download/nzbget-latest-bin-linux.run' -o package.run - G_EXEC mkdir -p /mnt/dietpi_userdata/nzbget + [[ -d '/mnt/dietpi_userdata/nzbget' ]] || G_EXEC mkdir /mnt/dietpi_userdata/nzbget G_EXEC_OUTPUT=1 G_EXEC dash package.run --destdir /mnt/dietpi_userdata/nzbget G_EXEC_NOHALT=1 G_EXEC rm package.run @@ -11056,24 +11049,21 @@ _EOF_ # Python build dependencies for ARM (( $G_HW_ARCH < 10 )) && G_AGI libffi-dev libssl-dev zlib1g-dev libjpeg-dev - if [[ -d '/mnt/dietpi_userdata/htpc-manager/.git' ]]; then - + if [[ -d '/mnt/dietpi_userdata/htpc-manager/.git' ]] + then G_EXEC cd /mnt/dietpi_userdata/htpc-manager G_EXEC_OUTPUT=1 G_EXEC git remote set-url origin "$url" G_EXEC_OUTPUT=1 G_EXEC git fetch origin G_EXEC_OUTPUT=1 G_EXEC git reset --hard origin G_EXEC_OUTPUT=1 G_EXEC git clean -dxfe '/userdata' - else - G_EXEC_OUTPUT=1 G_EXEC git clone --depth 1 "$url" - G_EXEC mkdir -p /mnt/dietpi_userdata/htpc-manager + [[ -d '/mnt/dietpi_userdata/htpc-manager' ]] || G_EXEC mkdir /mnt/dietpi_userdata/htpc-manager G_EXEC cp -a HTPC-Manager/. /mnt/dietpi_userdata/htpc-manager/ G_EXEC_NOHALT=1 G_EXEC rm -R HTPC-Manager G_EXEC cd /mnt/dietpi_userdata/htpc-manager G_EXEC_OUTPUT=1 G_EXEC git reset --hard origin G_EXEC_OUTPUT=1 G_EXEC git clean -dxfe '/userdata' - fi # Python deps @@ -11254,7 +11244,7 @@ _EOF_ G_EXEC mv /root/.steam /mnt/dietpi_userdata/steam else - G_EXEC mkdir -p /mnt/dietpi_userdata/steam + G_EXEC mkdir /mnt/dietpi_userdata/steam fi G_EXEC ln -s /mnt/dietpi_userdata/steam /root/.steam @@ -12152,7 +12142,7 @@ _EOF_ then G_EXEC mv /home/homeassistant/.homeassistant /mnt/dietpi_userdata/homeassistant else - G_EXEC mkdir -p /mnt/dietpi_userdata/homeassistant + G_EXEC mkdir /mnt/dietpi_userdata/homeassistant fi fi G_EXEC rm -Rf /home/homeassistant/.homeassistant @@ -12176,7 +12166,7 @@ _EOF_ #local file=$(curl -sSfL "$url/versions/$version/builds/$build"); file=${file##*\"name\":\"} file=${file%%\"*} # Download and install PaperMC Download_Install "$url/versions/$version/builds/$build/downloads/paper-$version-$build.jar" /opt/papermc/paperclip.jar - G_EXEC mkdir -p /mnt/dietpi_userdata/papermc + [[ -d '/mnt/dietpi_userdata/papermc' ]] || G_EXEC mkdir /mnt/dietpi_userdata/papermc G_EXEC eval 'echo "eula=true" > /mnt/dietpi_userdata/papermc/eula.txt' # User @@ -12265,7 +12255,7 @@ _EOF_ Download_Install "https://releases.domoticz.com/releases/release/domoticz_linux_${G_HW_ARCH_NAME/armv6l/armv7l}.tgz" /opt/domoticz # Data dir - G_EXEC mkdir -p /mnt/dietpi_userdata/domoticz + [[ -d '/mnt/dietpi_userdata/domoticz' ]] || G_EXEC mkdir /mnt/dietpi_userdata/domoticz # Config file if [[ ! -f '/mnt/dietpi_userdata/domoticz/domoticz.conf' ]]; then @@ -12471,7 +12461,7 @@ _EOF_ # Config: Do not touch on reinstall if [[ ! -f '/mnt/dietpi_userdata/spotifyd/spotifyd.conf' ]] then - G_EXEC mkdir -p /mnt/dietpi_userdata/spotifyd/cache + [[ -d '/mnt/dietpi_userdata/spotifyd/cache' ]] || G_EXEC mkdir /mnt/dietpi_userdata/spotifyd/cache dps_index=$software_id Download_Install 'spotifyd.conf' /mnt/dietpi_userdata/spotifyd/spotifyd.conf G_EXEC chmod 0600 /mnt/dietpi_userdata/spotifyd/spotifyd.conf fi From e3e0d2f6f997a0b0ed78e1b58874dacc0816a2f4 Mon Sep 17 00:00:00 2001 From: MichaIng Date: Sun, 30 Jan 2022 21:14:43 +0100 Subject: [PATCH 2/4] v8.1 - CHANGELOG | OpenBazaar: Since the original project has been taken down, we migrated to a fork which keeps up the marketplace for the community: https://github.com/MichaIng/DietPi/issues/5213 --- CHANGELOG.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 1ed6d949a0..2f22500ecf 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -21,6 +21,7 @@ Fixes: - DietPi-Software | Cuberite: Resolved an issue where the server failed to start on ARMv8 systems: https://github.com/MichaIng/DietPi/issues/5180 - DietPi-Software | MATE: Resolved an issue where the install failed when LXDE is installed already. Many thanks to @n0valis for reporting this issue: https://github.com/MichaIng/DietPi/issues/5214 - DietPi-Software | Ampache: Resolved an issue on Bullseye systems where Ampache v5 installs/reinstalls did not work because of a changed webroot directory: https://github.com/MichaIng/DietPi/pull/5205 +- DietPi-Software | OpenBazaar: Since the original project has been taken down, we migrated to a fork which keeps up the marketplace for the community: https://github.com/MichaIng/DietPi/issues/5213 As always, many smaller code performance and stability improvements, visual and spelling fixes have been done, too much to list all of them here. Check out all code changes of this release on GitHub: https://github.com/MichaIng/DietPi/pull/XXXX From 7685f9529b8c615d5c461d9907c40953d3f8e716 Mon Sep 17 00:00:00 2001 From: MichaIng Date: Mon, 31 Jan 2022 19:15:29 +0100 Subject: [PATCH 3/4] v8.1 - DietPi-Software | OpenBazaar: Install gcc and libc6-dev explicitly instead of full Build-Essential dependency --- dietpi/dietpi-software | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dietpi/dietpi-software b/dietpi/dietpi-software index 93cd081e7a..562350021b 100755 --- a/dietpi/dietpi-software +++ b/dietpi/dietpi-software @@ -1061,7 +1061,7 @@ INDEX_BROWSER=$INDEX_BROWSER" aSOFTWARE_CATX[$software_id]=6 aSOFTWARE_DOCS[$software_id]='https://dietpi.com/docs/software/social/#openbazaar' # x86_64 uses pre-compiled binaries, ARM requires Go for compiling - (( $G_HW_ARCH == 10 )) || aSOFTWARE_DEPS[$software_id]+=' 16 188' + (( $G_HW_ARCH == 10 )) || aSOFTWARE_DEPS[$software_id]+='188' aSOFTWARE_INTERACTIVE[$software_id]=1 #------------------ software_id=125 @@ -4349,6 +4349,7 @@ _EOF_ # ARM: Go build required else # OpenBazaar cannot be installed in module mode yet: https://github.com/OpenBazaar/openbazaar-go/issues/2072 + G_AGI gcc libc6-dev # Build it in legacy mode in tmpfs and move only binary in place G_EXEC cd "$G_WORKING_DIR" # Failsafe GO111MODULE=off GOPATH=$PWD HOME=$PWD G_EXEC_OUTPUT=1 G_EXEC go get -v github.com/mobazha/openbazaar-go From ed828b88bed78d45e94a99680de199e7bb046f5b Mon Sep 17 00:00:00 2001 From: MichaIng Date: Mon, 31 Jan 2022 20:18:26 +0100 Subject: [PATCH 4/4] v8.1 - DietPi-Software | OpenBazaar: Minor description change --- dietpi/dietpi-software | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dietpi/dietpi-software b/dietpi/dietpi-software index 562350021b..a2e749f4aa 100755 --- a/dietpi/dietpi-software +++ b/dietpi/dietpi-software @@ -1057,7 +1057,7 @@ INDEX_BROWSER=$INDEX_BROWSER" software_id=58 aSOFTWARE_NAME[$software_id]='OpenBazaar' - aSOFTWARE_DESC[$software_id]='decentralised peer to peer bitcoin market' + aSOFTWARE_DESC[$software_id]='Decentralised peer-to-peer Bitcoin marketplace' aSOFTWARE_CATX[$software_id]=6 aSOFTWARE_DOCS[$software_id]='https://dietpi.com/docs/software/social/#openbazaar' # x86_64 uses pre-compiled binaries, ARM requires Go for compiling