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,services}: Added soju IRC bouncer #7124

Merged
merged 4 commits into from
Jul 2, 2024
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
5 changes: 5 additions & 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 All @@ -261,6 +262,8 @@ do
#86|134|185) Process_Software 162;; # Docker does not start in systemd containers (without dedicated network)
166) Process_Software 70;;
180) (( $arch == 10 || $arch == 3 )) || Process_Software 170;;
188) Process_Software 17;;
213) Process_Software 17 188;;
*) :;;
esac
Process_Software "$i"
Expand Down Expand Up @@ -351,6 +354,7 @@ G_EXEC eval 'echo '\''infocmp "$TERM" > /dev/null 2>&1 || { echo "[ INFO ] Unsup
# Enable automated setup
G_CONFIG_INJECT 'AUTO_SETUP_AUTOMATED=' 'AUTO_SETUP_AUTOMATED=1' rootfs/boot/dietpi.txt
# - Workaround for skipped autologin in emulated Trixie/Sid containers: https://gitlab.com/qemu-project/qemu/-/issues/1962
# - Set HOME path, required e.g. go builds, which is otherwise missing when started from a systemd unit.
if [[ $DISTRO == 'trixie' ]] && (( $G_HW_ARCH != $arch && ( $G_HW_ARCH > 9 || $G_HW_ARCH < $arch ) ))
then
cat << '_EOF_' > rootfs/etc/systemd/system/dietpi-automation.service
Expand All @@ -361,6 +365,7 @@ After=dietpi-postboot.service
[Service]
Type=idle
StandardOutput=tty
Environment=HOME=/root
ExecStart=/bin/dash -c 'infocmp "$TERM" > /dev/null 2>&1 || export TERM=dumb; exec /boot/dietpi/dietpi-login'
ExecStop=/sbin/poweroff

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_6[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
1 change: 1 addition & 0 deletions dietpi/dietpi-services
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ _EOF_
'openbazaar'
'synapse'
'microblog-pub'
'soju'

# - Hardware Projects
'pi-spc'
Expand Down
89 changes: 89 additions & 0 deletions dietpi/dietpi-software
Original file line number Diff line number Diff line change
Expand Up @@ -1047,6 +1047,13 @@ Available commands:
aSOFTWARE_CATX[$software_id]=6
aSOFTWARE_DOCS[$software_id]='https://dietpi.com/docs/software/social/#mediawiki'
aSOFTWARE_DEPS[$software_id]='88 89 webserver'
#------------------
software_id=213
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'
aSOFTWARE_DEPS[$software_id]='188'

# Camera & Surveillance
#--------------------------------------------------------------------------------
Expand Down Expand Up @@ -12097,6 +12104,70 @@ If no WireGuard (auto)start is included, but you require it, please do the follo

unset -v choice_required domain port invalid_text server_ip
fi

if To_Install 213 soju # soju
then
# Dependencies
aDEPS=('make' 'scdoc' 'gcc' 'libsqlite3-dev' 'libpam-dev')

# 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 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 cp "${commands[@]}" /usr/local/bin/
G_EXEC mkdir -p /usr/local/share/man/man1
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 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://
listen unix+admin://
_EOF_
fi

# User
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: 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/
Documentation=man:soju(1) man:sojuctl(1)
Wants=network-online.target
After=network-online.target

[Service]
User=soju
RuntimeDirectory=soju
WorkingDirectory=/mnt/dietpi_userdata/soju
AmbientCapabilities=CAP_NET_BIND_SERVICE
MichaIng marked this conversation as resolved.
Show resolved Hide resolved
ExecStart=/usr/local/bin/soju
ExecReload=/bin/kill -HUP $MAINPID

[Install]
WantedBy=multi-user.target
_EOF_
fi
}

# $1: 0=None -1=Dropbear -2=OpenSSH
Expand Down Expand Up @@ -14229,6 +14300,24 @@ _EOF_
[[ -d '/mnt/dietpi_userdata/spotifyd' ]] && G_EXEC rm -R /mnt/dietpi_userdata/spotifyd
fi

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"
done
for x in "${manpages[@]}"
do
[[ -f /usr/local/share/man/man1/$x ]] && G_EXEC rm "/usr/local/share/man/man1/$x"
done
[[ -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'

# Uninstall finished, set all uninstalled software to state 0 (not installed)
Expand Down