tasksel: add custom (non-extensive) l10n setup for d-i

This commit is contained in:
Ark74 2025-08-18 05:29:32 -06:00
parent c8f629bbed
commit 46ebef52f1
16 changed files with 137 additions and 27 deletions

View file

@ -10,9 +10,22 @@ UDESCDIR=trisquel-tasks
DESCPO=$(DESCDIR)/po DESCPO=$(DESCDIR)/po
VERSION=$(shell expr "`dpkg-parsechangelog 2>/dev/null |grep Version:`" : '.*Version: \(.*\)' | cut -d - -f 1) VERSION=$(shell expr "`dpkg-parsechangelog 2>/dev/null |grep Version:`" : '.*Version: \(.*\)' | cut -d - -f 1)
LANGS=ar bg bn bs ca cs cy da de dz el eo es et eu fa fi fr gl gu he hi hr hu hy id it ja km ko lt lv mg mk nb ne nl nn pa pl pt_BR pt ro ru sk sl sq sv ta te th tl tr uk vi wo zh_CN zh_TW LANGS=ar bg bn bs ca cs cy da de dz el eo es et eu fa fi fr gl gu he hi hr hu hy id it ja km ko lt lv mg mk nb ne nl nn pa pl pt_BR pt ro ru sk sl sq sv ta te th tl tr uk vi wo zh_CN zh_TW
LANGS_DESC=ar bg bn bs ca cs cy da de dz el eo es et et eu fi fr gl gu he hi hr hu id it ja km ko lt lv mg mk nb ne nl nn pa pl pt_BR pt ro ru sk sl sq sv te th tl tr uk vi wo zh_CN zh_TW LANGS_DESC=ar bg bn bs ca cs cy da de dz el eo es et eu fi fr gl gu he hi hr hu id it ja km ko lt lv mg mk nb ne nl nn pa pl pt_BR pt ro ru sk sl sq sv te th tl tr uk vi wo zh_CN zh_TW
LOCALEDIR=$(DESTDIR)/usr/share/locale LOCALEDIR=$(DESTDIR)/usr/share/locale
# ---- L10N generation ----
# l10n base
L10N_PKGS = language-pack hunspell hyphen mythes
# Desktops l10n
L10N_PKGS += language-pack-gnome language-pack-kde
# Apps l10n (condition in runtime)
L10N_PKGS += abrowser-locale icedove-locale libreoffice-l10n
GEN_LANG_STAMP = $(UDESCDIR)/.lang_generated
$(GEN_LANG_STAMP): lang-gen.sh
./lang-gen.sh "$(LANGS_DESC)" "$(L10N_PKGS)" $(UDESCDIR)
touch $@
all: $(UTASKDESC) po/build_stamp all: $(UTASKDESC) po/build_stamp
$(TASKDESC): makedesc.pl $(DESCDIR)/[a-z]??* $(TASKDESC): makedesc.pl $(DESCDIR)/[a-z]??*
@ -22,8 +35,10 @@ $(TASKDESC): makedesc.pl $(DESCDIR)/[a-z]??*
$(UDESCDIR): trisquel-seeds.pl $(UDESCDIR): trisquel-seeds.pl
USUITE=$CODENAME USUITE=$CODENAME
$(UTASKDESC): makedesc.pl $(UDESCDIR)/[a-z]??* $(UTASKDESC): $(GEN_LANG_STAMP) makedesc.pl $(UDESCDIR)/*
./makedesc.pl $(UDESCDIR) $(UTASKDESC) ./makedesc.pl $(UDESCDIR) $(UTASKDESC)
# drop a blank first line if present to avoid parser warnings
sed -i '1{/^$$/d}' $(UTASKDESC)
%.o: %.c %.o: %.c
$(COMPILE) $< $(COMPILE) $<
@ -56,10 +71,12 @@ install:
pod2man --section=8 --center "Debian specific manpage" --release $(VERSION) tasksel.pod | gzip -9c > $(DESTDIR)/usr/share/man/man8/tasksel.8.gz pod2man --section=8 --center "Debian specific manpage" --release $(VERSION) tasksel.pod | gzip -9c > $(DESTDIR)/usr/share/man/man8/tasksel.8.gz
for lang in $(LANGS); do \ for lang in $(LANGS); do \
[ ! -d $(LOCALEDIR)/$$lang/LC_MESSAGES/ ] && mkdir -p $(LOCALEDIR)/$$lang/LC_MESSAGES/; \ [ ! -d $(LOCALEDIR)/$$lang/LC_MESSAGES/ ] && mkdir -p $(LOCALEDIR)/$$lang/LC_MESSAGES/; \
if [ -f po/$$lang.mo ]; then \
install -m 644 po/$$lang.mo $(LOCALEDIR)/$$lang/LC_MESSAGES/tasksel.mo; \ install -m 644 po/$$lang.mo $(LOCALEDIR)/$$lang/LC_MESSAGES/tasksel.mo; \
fi; \
done done
install-data: install-data: $(UTASKDESC)
install -d $(DESTDIR)$(TASKDIR)/descs \ install -d $(DESTDIR)$(TASKDIR)/descs \
$(DESTDIR)/usr/lib/tasksel/info \ $(DESTDIR)/usr/lib/tasksel/info \
$(DESTDIR)/usr/lib/tasksel/tests $(DESTDIR)/usr/lib/tasksel/tests
@ -77,15 +94,9 @@ install-data:
[ "$$package" = "packages/list" ] && continue; \ [ "$$package" = "packages/list" ] && continue; \
install -m 755 $$package $(DESTDIR)/usr/lib/tasksel/packages/; \ install -m 755 $$package $(DESTDIR)/usr/lib/tasksel/packages/; \
done done
#Dropped
# for lang in $(LANGS_DESC); do \
# [ ! -d $(LOCALEDIR)/$$lang/LC_MESSAGES/ ] && mkdir -p $(LOCALEDIR)/$$lang/LC_MESSAGES/; \
# install -m 644 $(DESCDIR)/po/$$lang.mo $(LOCALEDIR)/$$lang/LC_MESSAGES/$(DOMAIN).mo; \
# done
clean: clean:
rm -f $(TASKDESC) $(UTASKDESC) *~ rm -f $(TASKDESC) $(UTASKDESC) *~
rm -rf debian/external-overrides rm -rf debian/external-overrides
$(MAKE) -C po clean $(MAKE) -C po clean
$(MAKE) -C $(DESCPO) clean $(MAKE) -C $(DESCPO) clean

View file

@ -0,0 +1,50 @@
#!/bin/sh
set -e
# Args:
# $1 = LANGS_DESC (lista de códigos crudos)
# $2 = L10N_PKGS (familias base: language-pack, -gnome, hunspell, hyphen, mythes)
# $3 = destino (directorio trisquel-tasks)
raw_langs="$1"
families="$2"
dest="$3"
canon() {
case "$1" in
pt_BR) echo pt ;;
zh_CN) echo zh-hans ;;
zh_TW) echo zh-hant ;;
*) echo "${1%%_*}" ;;
esac
}
have_pkg() { apt-cache show "$1" >/dev/null 2>&1; }
mkdir -p "$dest"
# de-dup
uniq_langs=$(for l in $raw_langs; do canon "$l"; done | tr ' ' '\n' | sort -u)
for lang in $uniq_langs; do
base="language-pack-$lang"
if ! have_pkg "$base"; then
echo "skip: $lang (no $base)" >&2
continue
fi
f="$dest/l10n-$lang"
{
echo "Task: $lang"
echo "Description: $lang environment"
echo " This task localises the desktop in $lang."
echo "Key:"
echo " $base"
echo "Packages: list"
for fam in $families; do
echo " ${fam}-${lang}"
done
echo "Section: l10n"
echo "Test-lang: $lang"
echo
} > "$f"
done

57
helpers/DATA/tasksel/list Normal file
View file

@ -0,0 +1,57 @@
#!/bin/sh
# $1 = task name, $2..$N = packages (from "Packages: list")
# Runtime policy:
# - language-pack-gnome-* > MATE/GNOME/LXDE
# - language-pack-kde-* > KDE (Triskel)
# - abrowser-/firefox-locale-* > all desktops (MATE/GNOME/LXDE/KDE), not console
# - libreoffice-l10n-*, icedove-locale-* > MATE/GNOME/KDE; not LXDE/console
# - skip non-existent candidates (avoid APT 100)
shift 1
debconf_get() {
[ -x /usr/bin/debconf-communicate ] || return
printf 'GET %s\n' "$1" | /usr/bin/debconf-communicate 2>/dev/null \
| awk 'NR==1 && $1==0 { $1=""; sub(/^ /,""); print }'
}
has_pkg() { /usr/bin/dpkg-query -W -f='${Status}\n' "$1" 2>/dev/null | grep -q 'ok installed'; }
exists() { LC_ALL=C /usr/bin/apt-cache policy "$1" 2>/dev/null | awk '/Candidate:/ {print $2}' | grep -qxv '(none)'; }
sel="$(debconf_get pkgsel/desktop) $(debconf_get tasksel/first)"
case "$sel" in
*triskel*) FLAVOR=kde ;;
*trisquel-mini*) FLAVOR=lxde ;;
*trisquel-gnome*) FLAVOR=gnome ;;
*trisquel-desktop*) FLAVOR=mate ;;
*) FLAVOR=unknown ;;
esac
if [ "$FLAVOR" = unknown ]; then
if has_pkg triskel || has_pkg plasma-desktop; then FLAVOR=kde
elif has_pkg trisquel-mini || has_pkg lxde-core; then FLAVOR=lxde
elif has_pkg trisquel-gnome || has_pkg gnome-shell; then FLAVOR=gnome
elif has_pkg trisquel-desktop || has_pkg mate-desktop-environment; then FLAVOR=mate
else FLAVOR=console
fi
fi
is_kde=false; [ "$FLAVOR" = kde ] && is_kde=true
is_gtk=false; echo "$FLAVOR" | grep -Eq '^(mate|gnome|lxde)$' && is_gtk=true
is_console=false; [ "$FLAVOR" = console ] && is_console=true
is_desktop=true; $is_console && is_desktop=false
emit() {
p="$1"; [ -n "$p" ] || return
case "$p" in
language-pack-gnome-*) $is_gtk || return ;;
language-pack-kde-*) $is_kde || return ;;
abrowser-l10n-*|abrowser-locale-*|firefox-locale-*)
$is_desktop || return ;;
libreoffice-l10n-*) echo "$FLAVOR" | grep -Eq '^(lxde|console)$' && return ;;
icedove-locale-*) echo "$FLAVOR" | grep -Eq '^(lxde|console)$' && return ;;
esac
exists "$p" && printf '%s\n' "$p"
}
for p in "$@"; do emit "$p"; done

View file

@ -2,6 +2,5 @@ Task: dns-server
Section: server Section: server
Description: Bind9 DNS server Description: Bind9 DNS server
Selects the BIND DNS server and its documentation. Selects the BIND DNS server and its documentation.
Packages: list
Key: Key:
bind9 bind9

View file

@ -2,7 +2,6 @@ Task: ltsp-server
Section: user Section: user
Description: LTSP server Description: LTSP server
This task provides a LTSP server on a Trisquel console environment with a server optimized kernel. This task provides a LTSP server on a Trisquel console environment with a server optimized kernel.
Packages: list
Key: Key:
trisquel-base trisquel-base
trisquel-base-recommended trisquel-base-recommended

View file

@ -3,6 +3,5 @@ Section: server
Description: Postfix mail server Description: Postfix mail server
This task selects a variety of package useful for a general purpose mail This task selects a variety of package useful for a general purpose mail
server system. server system.
Packages: list
Key: Key:
postfix postfix

View file

@ -2,6 +2,5 @@ Task: openssh-server
Section: server Section: server
Description: OpenSSH secure shell server Description: OpenSSH secure shell server
Selects packages needed for an OpenSSH server. Selects packages needed for an OpenSSH server.
Packages: list
Key: Key:
openssh-server openssh-server

View file

@ -2,7 +2,6 @@ Task: print-server
Section: server Section: server
Description: Cups print server Description: Cups print server
This task sets up your system to be a print server. This task sets up your system to be a print server.
Packages: list
Key: Key:
cups cups
cups-bsd cups-bsd

View file

@ -3,6 +3,5 @@ Section: server
Description: Samba SMB file server Description: Samba SMB file server
This task sets up your system to be a Samba file server, which is This task sets up your system to be a Samba file server, which is
especially suitable in networks with both Windows and GNU/Linux systems. especially suitable in networks with both Windows and GNU/Linux systems.
Packages: list
Key: Key:
samba samba

View file

@ -2,7 +2,6 @@ Task: triskel
Section: user Section: user
Description: Triskel desktop environment Description: Triskel desktop environment
This task provides a KDE based Trisquel desktop environment and applications. This task provides a KDE based Trisquel desktop environment and applications.
Packages: list
Key: Key:
triskel triskel
triskel-recommended triskel-recommended

View file

@ -2,7 +2,6 @@ Task: trisquel-console
Section: user Section: user
Description: Trisquel console environment Description: Trisquel console environment
This task provides a basic Trisquel console environment This task provides a basic Trisquel console environment
Packages: list
Key: Key:
trisquel-base trisquel-base
trisquel-base-recommended trisquel-base-recommended

View file

@ -2,7 +2,6 @@ Task: trisquel-desktop
Section: user Section: user
Description: Trisquel desktop environment Description: Trisquel desktop environment
This task provides the standard Trisquel desktop environment and applications. This task provides the standard Trisquel desktop environment and applications.
Packages: list
Key: Key:
trisquel trisquel
trisquel-recommended trisquel-recommended

View file

@ -2,7 +2,6 @@ Task: trisquel-gnome
Section: user Section: user
Description: Trisquel GNOME environment Description: Trisquel GNOME environment
This task provides a Trisquel desktop based on the GNOME environment This task provides a Trisquel desktop based on the GNOME environment
Packages: list
Key: Key:
trisquel-gnome trisquel-gnome
trisquel-gnome-recommended trisquel-gnome-recommended

View file

@ -2,7 +2,6 @@ Task: trisquel-mini
Section: user Section: user
Description: Trisquel mini environment Description: Trisquel mini environment
This task provides a small Trisquel desktop environment This task provides a small Trisquel desktop environment
Packages: list
Key: Key:
trisquel-mini trisquel-mini
trisquel-mini-recommended trisquel-mini-recommended

View file

@ -2,7 +2,6 @@ Task: web-server
Section: server Section: server
Description: GLAMP web server Description: GLAMP web server
Selects a ready-made GNU+Linux/Apache/MySQL/PHP server. Selects a ready-made GNU+Linux/Apache/MySQL/PHP server.
Packages: list
Key: Key:
apache2 apache2
mysql-server mysql-server

View file

@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
# #
# Copyright (C) 2008-2020 Ruben Rodriguez <ruben@trisquel.info> # Copyright (C) 2008-2020 Ruben Rodriguez <ruben@trisquel.info>
# Copyright (C) 2022 Luis Guzman <ark@switnet.org> # Copyright (C) 2025 Luis Guzman <ark@switnet.org>
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@ -18,7 +18,7 @@
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
# #
VERSION=6 VERSION=7
COMPONENT=main COMPONENT=main
. ./config . ./config
@ -33,10 +33,14 @@ sed -i '/Package: task-desktop/,/$p/d' debian/control
cp -r $DATA/trisquel-tasks . cp -r $DATA/trisquel-tasks .
cp $DATA/Makefile . cp $DATA/Makefile .
cp $DATA/filter-tasks . cp $DATA/filter-tasks .
cp $DATA/lang-gen.sh .
cp $DATA/list packages/list
sed "/USUITE/s/.*/USUITE=$CODENAME/" Makefile -i sed "/USUITE/s/.*/USUITE=$CODENAME/" Makefile -i
replace "debian-tasks.desc" "trisquel-tasks.desc" replace "debian-tasks.desc" "trisquel-tasks.desc"
changelog "Added Trisquel's tasks" changelog "Added Trisquel's tasks
Added Trisquel's l10n tasksel implementation for d-i"
package package