summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-05-12 11:48:47 +0200
committerDanilo M. <danix@danix.xyz>2026-05-12 11:48:47 +0200
commit68e0cf99225f5e8b63ac76a2ca1f2089f942c0d3 (patch)
treed088f840bb57971a37ae6bf28b20ff7c2bb5dfbe
parent8684f17cd5d3a27c6c7180bb309b5db00befe957 (diff)
downloaddanixxyz-release_12052026-1149.tar.gz
danixxyz-release_12052026-1149.zip
Added: article slackware-templates-for-packages [en,it]release_12052026-1149
-rw-r--r--content/en/articles/slackware-templates-for-packages/index.md20
-rw-r--r--content/it/articles/slackware-templates-for-packages/index.md191
-rw-r--r--static/uppies/2026/05/water-02-1024x768.jpgbin0 -> 121487 bytes
3 files changed, 200 insertions, 11 deletions
diff --git a/content/en/articles/slackware-templates-for-packages/index.md b/content/en/articles/slackware-templates-for-packages/index.md
index 04c001a..b706187 100644
--- a/content/en/articles/slackware-templates-for-packages/index.md
+++ b/content/en/articles/slackware-templates-for-packages/index.md
@@ -1,13 +1,11 @@
+++
title = "Slackware Templates for Packages"
-
author = "Danilo M."
type = "tech"
date = "2026-05-11T18:51:37+02:00"
draft = true
excerpt = "slackpkg and dependency management in Slackware."
-
-image = ""
+image = "/uppies/2026/05/water-02-1024x768.jpg"
tags = ["linux", "howto", "do it yourself"]
categories = ["Code", "DIY"]
@@ -22,7 +20,7 @@ The same applies to package compilation; since it doesn't manage dependencies, y
To solve this last problem, there are software programs like [sbopkg](https://www.sbopkg.org/) that allow you to generate compilation queues to compile the packages needed for the software in the correct order.
-One step further than sbopkg is **slackrepo**, software that I have already talked about in my [articolo sulla gestione dei pacchetti nel 2026](../manage-slackware-packages-2026/), as it also allows you to compile the packages in the correct order with respect to the dependencies of each individual program, but in addition, it installs the already compiled dependencies one by one and then removes them once the compilation of the software that required them is finished.
+One step further than sbopkg is **slackrepo**, software that I have already talked about in my [article about managing packages in slackware in 2026](../manage-slackware-packages-2026/), as it also allows you to compile the packages in the correct order with respect to the dependencies of each individual program, but in addition, it installs the already compiled dependencies one by one and then removes them once the compilation of the software that required them is finished.
The most interesting feature of slackrepo, however, is the ability to queue "hooks" to the execution of the program, i.e., to execute code that is not part of slackrepo to extend its functionality. In particular, in my setup, I use several hooks:
@@ -31,11 +29,11 @@ The most interesting feature of slackrepo, however, is the ability to queue "hoo
- I generate the .template files for those software programs that have one or more dependencies.
- I upload the files to the repository using rsync.
-{{< actions url="https://packages.danix.xyz" desc="I miei pacchetti" use="site" caption="Il mio repository di pacchetti per slackware64-current" >}}
+{{< actions url="https://packages.danix.xyz" desc="my packages" use="site" caption="My packages repository for slackware64-current" >}}
### hook "git fetch"
-This hook takes care of updating the local repository by cloning Ponce's git (it's on *-current*), then it performs the rebase and stops the execution if there are any conflicts, so I know if any of my personal packages conflict with SBo's. In case of conflicts, I can resolve them by deleting my package or the official one, depending on the situation.
+This hook takes care of updating the local repository by cloning Ponce's git (I'm on *-current*), then it performs the rebase and stops the execution if there are any conflicts, so I know if any of my personal packages conflict with SBo's. In case of conflicts, I can resolve them by deleting my package or the official one, depending on the situation.
```bash
function danix_gitfetch_hook
@@ -74,7 +72,7 @@ function danix_gitfetch_hook
### hook "gen web files"
-This hook takes care of launching my script `gen_web_hook.sh` (visible on [mio git](https://git.danix.xyz/pkgs-html-structure/tree/gen_web_hook.sh)) to generate the HTML files that will then be uploaded online to the package repository and that are used for viewing the repository online.
+This hook takes care of launching my script `gen_web_hook.sh` (visible on [my git](https://git.danix.xyz/pkgs-html-structure/tree/gen_web_hook.sh)) to generate the HTML files that will then be uploaded online to the package repository and that are used for viewing the repository online.
```bash
function gen_web_hook
@@ -89,7 +87,7 @@ function gen_web_hook
}
```
-{{< actions url="https://git.danix.xyz" desc="Il mio repository git" use="repo" caption="Dai un'occhiata al mio codice sul repo git." >}}
+{{< actions url="https://git.danix.xyz" desc="my git repository" use="repo" caption="Have a look at my code on my git repo." >}}
### hook "template generator"
@@ -170,10 +168,10 @@ function rsync_push_hook
## The .template files and slackpkg
-At the end of the compilation of software that has some dependencies, in my repository, the file `<nome_pacchetto>.template` will be generated, which I can copy into `/etc/slackpkg/templates` and call with:
+At the end of the compilation of software that has some dependencies, in my repository, the file `<package_name>.template` will be generated, which I can copy into `/etc/slackpkg/templates` and call with:
```bash
-slackpkg install-template nome_pacchetto
+slackpkg install-template package_name
```
and slackpkg will automatically prompt me to install all the dependencies listed in the template, effectively simplifying dependency management.
@@ -190,4 +188,4 @@ waybar
I hope this article can be useful to someone, even if only as a starting point to simplify things a bit :wink:
-{{< actions url="/it/is/here/" desc="Scrivimi" use="site" caption="Se hai dei commenti, lasciami pure un messaggio" >}} \ No newline at end of file
+{{< actions url="/it/is/here/" desc="Contact me" use="site" caption="If you have any comments, leave a message." >}} \ No newline at end of file
diff --git a/content/it/articles/slackware-templates-for-packages/index.md b/content/it/articles/slackware-templates-for-packages/index.md
new file mode 100644
index 0000000..ff6df76
--- /dev/null
+++ b/content/it/articles/slackware-templates-for-packages/index.md
@@ -0,0 +1,191 @@
++++
+title = "Templates Slackware per i pacchetti"
+author = "Danilo M."
+type = "tech"
+date = "2026-05-11T18:51:37+02:00"
+draft = true
+excerpt = "slackpkg e la gestione delle dipendenze in slackware."
+image = "/uppies/2026/05/water-02-1024x768.jpg"
+tags = ["linux", "howto", "do it yourself"]
+categories = ["Code", "DIY"]
+
++++
+
+Slackware è fantastica per gestire il sistema in quanto ti permette di modificare facilmente qualsiasi cosa, semplicemente andando a cambiare un valore in un file di testo.
+
+Slackware è un po' meno fantastica quando devi andare ad installare un pacchetto per un software che si porta dietro svariate dipendenze :sweat:. Non ha di default la gestione automatica delle dipendenze e quindi tutto il lavoro ricade sull'utente che gestisce il sistema.
+
+Lo stesso discorso vale per la compilazione dei pacchetti, infatti non gestendo le dipendenze, anche in fase di compilazione bisogna fare tutto a manina, compilando i pacchetti nel giusto ordine per poter ottenere il software che ci interessa installare.
+
+## SlackRepo
+
+per risolvere quest'ultimo problema, esistono software come [sbopkg](https://www.sbopkg.org/) che permettono di generare delle code di compilazione per andare a compilare nel corretto ordine i pacchetti necessari al software che ci interessa.
+Uno step ulteriore rispetto a sbopkg, lo fa **slackrepo**, software di cui ho già parlato nel mio [articolo sulla gestione dei pacchetti nel 2026](../manage-slackware-packages-2026/), in quanto permette anch'esso di compilare i pacchetti nell'ordine corretto rispetto alle dipendenze di ogni singolo programma, ma in più, va ad installare le dipendenze già compilate di volta in volta per poi rimuoverle una volta finita la compilazione del software che la richiedeva.
+
+La funzionalità più interessante di slackrepo è però la possibilità di accodare all'esecuzione del programma degli "hook", ovvero di eseguire del codice che non fa parte di slackrepo, per estenderne le funzionalità. In particolare nel mio setup, io uso diversi hook:
+
+- aggiorno il repository via git eseguendo il rebase di volta in volta.
+- genero i file html che vengono poi inseriti nel [repository](https://packages.danix.xyz/).
+- genero i files .template per quei software che hanno una o più dipendenze
+- carico i files sul repository usando rsync.
+
+{{< actions url="https://packages.danix.xyz" desc="I miei pacchetti" use="site" caption="Il mio repository di pacchetti per slackware64-current" >}}
+
+### hook "git fetch"
+
+questo hook si occupa di aggiornare il repository locale clonando il git di Ponce (sono su *-current*), poi esegue il rebase e interrompe l'esecuzione in caso ci siano dei conflitti, così so se qualche mio pacchetto personale contrasta con quelli di SBo. In caso di conflitti posso andare a risolvere eliminando il mio pacchetto o quello ufficiale a seconda delle situazioni.
+
+```bash
+function danix_gitfetch_hook
+{
+ local upstream_branch='current'
+ local personal_branch='danix-current'
+
+ cd "$SR_SBREPO" || return 1
+
+ local currbranch
+ currbranch=$(git rev-parse --abbrev-ref HEAD)
+ if [ "$currbranch" != "$personal_branch" ]; then
+ echo "slackrepo: WARNING: SBREPO is on branch '$currbranch', expected '$personal_branch'. Skipping git update."
+ return 0
+ fi
+
+ local muck
+ muck=$(git status -s .)
+ if [ -n "$muck" ]; then
+ echo "slackrepo: WARNING: SBREPO has uncommitted changes. Skipping git update."
+ return 0
+ fi
+
+ echo "slackrepo: Fetching upstream SBo..."
+ git fetch origin || { echo "slackrepo: WARNING: git fetch failed."; return 1; }
+
+ echo "slackrepo: Rebasing $personal_branch onto origin/$upstream_branch..."
+ git rebase --rebase-merges -X theirs origin/"$upstream_branch" || {
+ echo "slackrepo: ERROR: rebase failed. Resolve conflicts in $SR_SBREPO and run 'git rebase --continue'."
+ return 1
+ }
+
+ return 0
+}
+```
+
+### hook "gen web files"
+
+Questo hook si occupa di lanciare il mio script `gen_web_hook.sh` (visibile sul [mio git](https://git.danix.xyz/pkgs-html-structure/tree/gen_web_hook.sh)) per generare i file html che verranno poi caricati online nel repository dei pacchetti e che servono per la visualizzazione del repo online.
+
+```bash
+function gen_web_hook
+{
+ if [ "$OPT_DRY_RUN" = 'y' ] || [ ! -s "$CHANGELOG" ]; then
+ return 0
+ fi
+ SR_PKGREPO="$SR_PKGREPO" /usr/local/bin/gen_web_hook.sh
+ local stat=$?
+ [ $stat -ne 0 ] && log_warning "gen_web_hook failed, status $stat"
+ return $stat
+}
+```
+
+{{< actions url="https://git.danix.xyz" desc="Il mio repository git" use="repo" caption="Dai un'occhiata al mio codice sul repo git." >}}
+
+### hook "template generator"
+
+Ecco la funzione che si occupa di generare i files .template usati da slackpkg per installare i pacchetti.
+
+```bash
+function dep_template_hook
+{
+ local template_dir="${TEMPLATE_DIR:-/repo/templates}"
+
+ [ "$OPT_DRY_RUN" = 'y' ] && return 0
+ [ ${#OKLIST[@]} -eq 0 ] && return 0
+
+ mkdir -p "$template_dir" || return 1
+
+ local itemid prgnam dep depname outfile
+ for itemid in "${OKLIST[@]}"; do
+ [ -z "${FULLDEPS[$itemid]}" ] && continue
+
+ prgnam="${ITEMPRGNAM[$itemid]}"
+ outfile="$template_dir/${prgnam}.template"
+
+ {
+ for dep in ${FULLDEPS[$itemid]}; do
+ depname="${ITEMPRGNAM[$dep]}"
+ printf '%s\n' "${depname:-$dep}"
+ done
+ printf '%s\n' "$prgnam"
+ } > "$outfile"
+
+ log_normal "dep_template_hook: wrote $outfile"
+ done
+
+ return 0
+}
+```
+
+### hook "rsync push"
+
+Infine l'hook che si occupa di caricare i files modificati sul mio repository online:
+
+```bash
+function rsync_push_hook
+{
+ # RSYNC_TARGET/RSYNC_EXCLUDES are unset by slackrepo after config sourcing;
+ # use hardcoded values here since they can't be passed via SR_ prefix mechanism.
+ local rsync_target='<SERVER_RSYNC>'
+ local rsync_excludes='<FILES_ESCLUSI.txt>'
+ local rsync_password_file='<PASSWORD_SERVER_RSYNC>'
+
+ if [ "$OPT_DRY_RUN" = 'y' ] || [ ! -s "$CHANGELOG" ]; then
+ return 0
+ fi
+
+ local rsync_bin
+ rsync_bin=$(which rsync 2>/dev/null)
+ if [ ! -x "$rsync_bin" ]; then
+ log_warning "rsync not found, skipping rsync_push_hook"
+ return 1
+ fi
+
+ local args=( -havz --delete-after )
+ [ -n "$rsync_excludes" ] && [ -f "$rsync_excludes" ] && \
+ args+=( --exclude-from="$rsync_excludes" )
+ [ -f "$rsync_password_file" ] && args+=( --password-file="$rsync_password_file" )
+
+ log_normal "Pushing packages to $rsync_target ..."
+ "$rsync_bin" "${args[@]}" "$SR_PKGREPO"/ "$rsync_target"
+ local rsyncstat=$?
+ if [ "$rsyncstat" != 0 ]; then
+ log_warning "rsync_push_hook failed, status $rsyncstat"
+ return 1
+ fi
+ log_normal "rsync push complete."
+ return 0
+}
+```
+
+## I file .template e slackpkg
+
+Alla fine della compilazione di un software che ha qualche dipendenza, nel mio repository, verrà generato il file `<nome_pacchetto>.template`, che potrò copiare in `/etc/slackpkg/templates` e richiamare con:
+
+```bash
+slackpkg install-template nome_pacchetto
+```
+
+e slackpkg andrà automaticamente a propormi di installare anche tutte le dipendenze elencate nel template, di fatto semplificando molto la gestione delle dipendenze.
+
+Un esempio di template, direttamente dal mio repository è [waybar.template](https://packages.danix.xyz/templates/waybar.template):
+
+```
+date
+jsoncpp
+Catch2
+spdlog
+waybar
+```
+
+Spero che quest'articolo possa tornare utile a qualcuno, anche solo come spunto per semplificare un po' la vita :wink:
+
+{{< actions url="/it/is/here/" desc="Scrivimi" use="site" caption="Se hai dei commenti, lasciami pure un messaggio" >}}
diff --git a/static/uppies/2026/05/water-02-1024x768.jpg b/static/uppies/2026/05/water-02-1024x768.jpg
new file mode 100644
index 0000000..29e9420
--- /dev/null
+++ b/static/uppies/2026/05/water-02-1024x768.jpg
Binary files differ