Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DietPi-Software | OpenBazaar: Switch to fork #5222

Merged
merged 4 commits into from
Jan 31, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
93 changes: 42 additions & 51 deletions dietpi/dietpi-software
Original file line number Diff line number Diff line change
Expand Up @@ -1057,11 +1057,11 @@ 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'
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]+='188'
aSOFTWARE_INTERACTIVE[$software_id]=1
#------------------
software_id=125
Expand Down Expand Up @@ -2951,7 +2951,7 @@ _EOF_

else

G_EXEC mkdir -p /mnt/dietpi_userdata/postgresql
G_EXEC mkdir /mnt/dietpi_userdata/postgresql

fi

Expand Down Expand Up @@ -4340,28 +4340,29 @@ _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

# 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/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

Expand All @@ -4373,28 +4374,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
Expand Down Expand Up @@ -4553,7 +4547,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
Expand Down Expand Up @@ -5456,12 +5450,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

Expand All @@ -5470,7 +5464,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

Expand Down Expand Up @@ -5672,7 +5666,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
Expand Down Expand Up @@ -5921,7 +5915,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

Expand Down Expand Up @@ -7834,7 +7828,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
Expand Down Expand Up @@ -7877,7 +7871,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
Expand Down Expand Up @@ -9177,7 +9171,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
Expand Down Expand Up @@ -9455,7 +9449,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
Expand Down Expand Up @@ -9568,7 +9562,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
Expand Down Expand Up @@ -9739,7 +9733,7 @@ _EOF_
G_EXEC sed -i '\|:8384</address>|c\ <address>0.0.0.0:8384</address>' /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 '\|<folder id="default"|s|label="[^"]*"|label="Syncthing Data"|' /mnt/dietpi_userdata/syncthing/config.xml
sed -i '\|<folder id="default"|s|path="[^"]*"|path="/mnt/dietpi_userdata/syncthing_data"|' /mnt/dietpi_userdata/syncthing/config.xml
Expand Down Expand Up @@ -10134,7 +10128,7 @@ _EOF_
Create_User -d /mnt/dietpi_userdata/firefox-sync ffsync

# Create database and config directory
G_EXEC mkdir -p /mnt/dietpi_userdata/firefox-sync
[[ -d '/mnt/dietpi_userdata/firefox-sync' ]] || G_EXEC mkdir /mnt/dietpi_userdata/firefox-sync

# Create database if it doesn't exist
[[ -f '/mnt/dietpi_userdata/firefox-sync/FF-Sync-DB.db' ]] || G_EXEC sqlite3 /mnt/dietpi_userdata/firefox-sync/FF-Sync-DB.db 'create table aTable(field1 int); drop table aTable;'
Expand Down Expand Up @@ -10243,7 +10237,7 @@ _EOF_
# User
Create_User -d /mnt/dietpi_userdata/vaultwarden vaultwarden

[[ ! -d '/mnt/dietpi_userdata/vaultwarden' ]] && G_EXEC mkdir -p /mnt/dietpi_userdata/vaultwarden
[[ ! -d '/mnt/dietpi_userdata/vaultwarden' ]] && G_EXEC mkdir /mnt/dietpi_userdata/vaultwarden

# Config: Preserve old
if [[ ! -f '/mnt/dietpi_userdata/vaultwarden/vaultwarden.env' ]]
Expand Down Expand Up @@ -10492,7 +10486,7 @@ _EOF_
[[ -f '/mnt/dietpi_userdata/sonarr/nzbdrone.db.bak' ]] && G_EXEC_NOEXIT=1 G_EXEC rm /mnt/dietpi_userdata/sonarr/nzbdrone.db.bak

# Data dir
G_EXEC mkdir -p /mnt/dietpi_userdata/sonarr
[[ -d '/mnt/dietpi_userdata/sonarr' ]] || G_EXEC mkdir /mnt/dietpi_userdata/sonarr

# User
Create_User -g dietpi -d /mnt/dietpi_userdata/sonarr sonarr
Expand Down Expand Up @@ -10600,7 +10594,7 @@ _EOF_
[[ -f '/mnt/dietpi_userdata/radarr/nzbdrone.db.bak' ]] && G_EXEC_NOEXIT=1 G_EXEC rm /mnt/dietpi_userdata/radarr/nzbdrone.db.bak

# Data dir
G_EXEC mkdir -p /mnt/dietpi_userdata/radarr
[[ -d '/mnt/dietpi_userdata/radarr' ]] || G_EXEC mkdir /mnt/dietpi_userdata/radarr

# User
Create_User -g dietpi -d /mnt/dietpi_userdata/radarr radarr
Expand Down Expand Up @@ -10708,7 +10702,7 @@ _EOF_
fi

# Data dir
G_EXEC mkdir -p /mnt/dietpi_userdata/lidarr
[[ -d '/mnt/dietpi_userdata/lidarr' ]] || G_EXEC mkdir /mnt/dietpi_userdata/lidarr

# User
Create_User -g dietpi -d /mnt/dietpi_userdata/lidarr lidarr
Expand Down Expand Up @@ -10779,7 +10773,7 @@ _EOF_
G_EXEC cd "$G_WORKING_DIR"

# Data dir
G_EXEC mkdir -p /mnt/dietpi_userdata/bazarr
[[ -d '/mnt/dietpi_userdata/bazarr' ]] || G_EXEC mkdir /mnt/dietpi_userdata/bazarr

# User
Create_User -g dietpi -d /mnt/dietpi_userdata/bazarr bazarr
Expand Down Expand Up @@ -10871,7 +10865,7 @@ _EOF_
Create_User -d /mnt/dietpi_userdata/tautulli tautulli

# Directory
G_EXEC mkdir -p /mnt/dietpi_userdata/tautulli
[[ -d '/mnt/dietpi_userdata/tautulli' ]] || G_EXEC mkdir /mnt/dietpi_userdata/tautulli

# Service: https://github.com/Tautulli/Tautulli/blob/master/init-scripts/init.systemd
cat << _EOF_ > /etc/systemd/system/tautulli.service
Expand Down Expand Up @@ -10995,7 +10989,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

Expand Down Expand Up @@ -11056,24 +11050,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
Expand Down Expand Up @@ -11254,7 +11245,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

Expand Down Expand Up @@ -12152,7 +12143,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
Expand All @@ -12176,7 +12167,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
Expand Down Expand Up @@ -12265,7 +12256,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
Expand Down Expand Up @@ -12471,7 +12462,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
Expand Down