Skip to content

Commit

Permalink
v9.6
Browse files Browse the repository at this point in the history
- DietPi-Software | soju: Get latest version for GitHub API automatically. Fix syntax to pass GOFLAGS correctly. Make /mnt/dietpi_userdata/soju the home dir for the soju user. Slight systemd unit cleanup. Align uninstall code.
- CI | DietPi-Software: Add test service and TCP port for soju
- META | Add changelog and readme entry about soju, and support it with our survey report page.
  • Loading branch information
MichaIng committed Jul 2, 2024
1 parent 14aab53 commit 041d9cf
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 32 deletions.
1 change: 1 addition & 0 deletions .github/workflows/dietpi-software.bash
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ Process_Software()
209) aCOMMANDS[i]='restic version';;
211) aCOMMANDS[i]='hb-service status' aSERVICES[i]='homebridge' aTCP[i]='8581'; (( $arch < 10 )) && aDELAY[i]=30; (( $arch == 3 )) && aDELAY[i]=120;;
212) aSERVICES[i]='kavita' aTCP[i]='2036'; (( $arch < 10 )) && aDELAY[i]=180; (( $arch == 10 )) && aDELAY[i]=30;;
213) aSERVICES[i]='soju' aTCP[i]='6667';;
*) :;;
esac
done
Expand Down
1 change: 1 addition & 0 deletions .meta/dietpi-survey_report
Original file line number Diff line number Diff line change
Expand Up @@ -726,6 +726,7 @@ shopt -s extglob
do
aSOFTWARE_NAME9_6[i]=${aSOFTWARE_NAME9_5[i]}
done
aSOFTWARE_NAME9_5[213]='soju'

# Pre-create software counter array so that we can see also software (available in newest version) with 0 installs
for i in "${aSOFTWARE_NAME9_6[@]}"
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
v9.6
(2024-07-06)

New software:
- soju | This IRC bouncer has been added to our software catalogue. Many thanks to @subnut for implementing it: https://github.com/MichaIng/DietPi/pull/7124

Enhancements:
- General | Since we provide all kernel, bootloader and firmware packages from our own APT repository now, the Armbian APT repository is removed form all systems. In case you use an SBC which is not officially supported by DietPi, as generic device, it is however preserved.
- Quartz64/Star64/VisionFive 2 | The extended attribute handler for ext4 security labels "CONFIG_EXT4_FS_SECURITY" has been enabled for these SBCs, required for some Docker containers. Many thanks to @gxsw for reporting this missing feature: https://github.com/MichaIng/DietPi/issues/7102
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,7 @@ Links to hardware and software manufacturers, sources and build instructions use
- [ADS-B Feeder](https://github.com/dirkhh/adsb-feeder-image)
- [Kavita](https://github.com/Kareadita/Kavita)
- [Forgejo](https://codeberg.org/forgejo/forgejo)
- [soju](https://github.com/emersion/soju)

---

Expand Down
63 changes: 31 additions & 32 deletions dietpi/dietpi-software
Original file line number Diff line number Diff line change
Expand Up @@ -1049,7 +1049,7 @@ Available commands:
aSOFTWARE_DEPS[$software_id]='88 89 webserver'
#------------------
software_id=213
aSOFTWARE_NAME[$software_id]='Soju'
aSOFTWARE_NAME[$software_id]='soju'
aSOFTWARE_DESC[$software_id]='A user-friendly IRC bouncer'
aSOFTWARE_CATX[$software_id]=6
aSOFTWARE_DOCS[$software_id]='https://dietpi.com/docs/software/social/#soju'
Expand Down Expand Up @@ -12107,30 +12107,32 @@ If no WireGuard (auto)start is included, but you require it, please do the follo

if To_Install 213 # soju
then
local ver=0.8.0
# Dependencies
aDEPS=('gcc' 'make' 'pkg-config' 'scdoc' 'libpam-dev' 'libsqlite3-dev')
Download_Install "https://git.sr.ht/~emersion/soju/archive/v${ver}.tar.gz"
G_EXEC cd "soju-v${ver}"

# Download
local fallback_url='https://github.com/emersion/soju/releases/download/v0.8.0/soju-0.8.0.tar.gz'
Download_Install "$(curl -sSfL 'https://api.github.com/repos/emersion/soju/releases/latest' | mawk -F\" '/^ *"browser_download_url": ".*\/soju-[^"\/]*\.tar\.gz"$/{print $4}')"

# Build
G_EXEC_OUTPUT=1 G_EXEC make all "-j$(nproc)" \
config_path=/mnt/dietpi_userdata/soju/config
GOFLAGS=-tags=pam,libsqlite3 \
G_EXEC cd soju-*
G_EXEC_OUTPUT=1 G_EXEC make all "-j$(nproc)" config_path='/mnt/dietpi_userdata/soju/config' GOFLAGS='-tags=pam,libsqlite3'

# Install
local commands=('soju' 'sojuctl' 'sojudb')
local manpages=('doc/soju.1' 'doc/sojuctl.1')
G_EXEC mkdir -p /usr/local/bin
G_EXEC cp "${commands[@]}" /usr/local/bin/
G_EXEC mkdir -p /usr/local/share/man/man1
G_EXEC mkdir -p /mnt/dietpi_userdata/soju
G_EXEC cp "${commands[@]}" /usr/local/bin
G_EXEC cp "${manpages[@]}" /usr/local/share/man/man1
if [[ ! -f '/mnt/dietpi_userdata/soju/config' ]]; then
G_EXEC cp "${manpages[@]}" /usr/local/share/man/man1/

# Config
if [[ ! -f '/mnt/dietpi_userdata/soju/config' ]]
then
# We shall default to on-disk chat logs
# It's a lossy format, as stated under `message-store` subsection in https://soju.im/doc/soju.1.html#CONFIG_FILE
# But it's the recommended setting as per https://git.sr.ht/~emersion/soju/tree/master/doc/getting-started.md
G_EXEC touch /mnt/dietpi_userdata/soju/config
cat <<- _EOF_ > /mnt/dietpi_userdata/soju/config
G_EXEC mkdir -p /mnt/dietpi_userdata/soju
cat <<- '_EOF_' > /mnt/dietpi_userdata/soju/config
db sqlite3 /mnt/dietpi_userdata/soju/data.db
message-store fs /mnt/dietpi_userdata/soju/logs
listen irc+insecure://
Expand All @@ -12139,14 +12141,14 @@ If no WireGuard (auto)start is included, but you require it, please do the follo
fi

# User
Create_User soju
G_EXEC chown soju:soju -R /mnt/dietpi_userdata/soju
Create_User -d /mnt/dietpi_userdata/soju soju
G_EXEC chown 'soju:soju' -R /mnt/dietpi_userdata/soju
G_EXEC chmod 0660 -R /mnt/dietpi_userdata/soju
G_EXEC chmod 0770 /mnt/dietpi_userdata/soju

# Service
# Modified version of ./contrib/soju.service
cat << _EOF_ > /etc/systemd/system/soju.service
# Service: https://github.com/emersion/soju/blob/master/contrib/soju.service
# - CAP_NET_BIND_SERVICE needed for builtin identd server: https://github.com/emersion/soju/blob/master/doc/packaging.md#binding-to-privileged-ports
cat << '_EOF_' > /etc/systemd/system/soju.service
[Unit]
Description=soju IRC bouncer service
Documentation=https://soju.im/
Expand All @@ -12155,16 +12157,14 @@ Wants=network-online.target
After=network-online.target

[Service]
Type=simple
User=soju
Group=soju
RuntimeDirectory=soju
RuntimeDirectoryMode=0770
RuntimeDirectoryPreserve=restart
WorkingDirectory=/mnt/dietpi_userdata/soju
AmbientCapabilities=CAP_NET_BIND_SERVICE
ExecStart=/usr/local/bin/soju
ExecReload=/bin/kill -HUP \$MAINPID
ExecReload=/bin/kill -HUP $MAINPID
Restart=on-failure

[Install]
Expand Down Expand Up @@ -14303,23 +14303,22 @@ _EOF_
[[ -d '/mnt/dietpi_userdata/spotifyd' ]] && G_EXEC rm -R /mnt/dietpi_userdata/spotifyd
fi

if To_Uninstall 213 # Soju
if To_Uninstall 213 # soju
then
Remove_Service soju 1 1

local x
local commands=('soju' 'sojuctl' 'sojudb')
local manpages=('soju.1' 'sojuctl.1')
for x in "${commands[@]}"; do
[[ -f "/usr/local/bin/$x" ]] &&
G_EXEC rm "/usr/local/bin/$x"
for x in "${commands[@]}"
do
[[ -f /usr/local/bin/$x ]] && G_EXEC rm "/usr/local/bin/$x"
done
for x in "${manpages[@]}"; do
[[ -f "/usr/local/share/man/man${x##*.}/$x" ]] &&
G_EXEC rm "/usr/local/share/man/man${x##*.}/$x"
for x in "${manpages[@]}"
do
[[ -f /usr/local/share/man/man1/$x ]] && G_EXEC rm "/usr/local/share/man/man1/$x"
done
[[ -d '/mnt/dietpi_userdata/soju' ]] &&
G_EXEC rm -Rf /mnt/dietpi_userdata/soju
[[ -d '/usr/local/share/man/man1' ]] && G_EXEC rmdir -p --ignore-fail-on-non-empty /usr/local/share/man/man1
[[ -d '/mnt/dietpi_userdata/soju' ]] && G_EXEC rm -Rf /mnt/dietpi_userdata/soju
fi

G_DIETPI-NOTIFY 3 "$G_PROGRAM_NAME" 'Finalising uninstall'
Expand Down

0 comments on commit 041d9cf

Please sign in to comment.