Files
eos-pkgbuild-setup/assets.conf.endeavouros

395 lines
11 KiB
Bash

#!/bin/bash
# Definitions for the [endeavouros] repo at 'mirrors'.
# Note: this file will be sourced into a function,
# so all variables are made 'local'.
# shellcheck disable=2168,2034,2190
local REPONAME="endeavouros"
local RELEASE_TAGS=(
endeavouros
)
## user to sign packages
local SIGNER="manuel@endeavouros.com" # "EndeavourOS"
## general options
local USE_GENERATED_FILELIST="no" # may generate 'repofiles.txt' into the repo
local USE_RELEASE_ASSETS="yes" # either 'release assets' or "ordinary" github files
local RELEASE_ASSETS_REMOTE_BASE="https://github.com/endeavouros-team/repo/releases/download/endeavouros" # download remote release asset files from here
local PREFER_GIT_OVER_RELEASE=yes
local ARCHIVE_TAG=packages
local AUR_PKG_CHECKING=yes
export MAKEPKG_CLEANUP=yes # some of *our* PKGBUILD files (e.g. yay) may use this!
## local folders
local ASSETSDIR="$EOS_ROOT/_BUILD_/$REPONAME"
local PKGBUILD_ROOTDIR="$ASSETSDIR/PKGBUILDS"
local GITDIR="$EOS_ROOT/repo"
local ARCHIVE_GIT="$EOS_ROOT/archive/.git"
# PKGNAMES is the current build list for the packages at the [endeavouros] repository.
#
# Notes:
# - The AUR package names require suffix "/aur".
# - The EndeavourOS names are actually folder names for packages under PKGBUILDS, not actual package names!
#
PKGNAMES=( # Alphabetically ordered.
akm
bash-app-translate
calamares
ckbcomp
downgrade
dracut # added 15.8.2025 (version 108_eos-1)
endeavouros-branding
endeavouros-keyring
endeavouros-konsole-colors
endeavouros-mirrorlist
endeavouros-xfce4-terminal-colors
eos-apps-info
eos-bash-shared
eos-breeze-sddm
eos-downgrade
eos-dracut # was: dracut-hook/aur
eos-hooks
eos-hwtool
eos-iso-hotfix
eos-lightdm-gtk-theme
eos-lightdm-slick-theme
eos-log-tool
eos-lxdm-gtk3
eos-manual-intervention
eos-packagelist
eos-qogir-icons
eos-quickstart
eos-rankmirrors
eos-reboot-recommended
eos-sddm-theme
eos-settings-budgie
eos-settings-cinnamon
eos-settings-cosmic
eos-settings-gnome
eos-settings-i3wm
eos-settings-lxde
eos-settings-lxqt
eos-settings-mate
eos-settings-plasma
eos-settings-sway
eos-settings-xfce4
eos-sway-tools
eos-translations
eos-update
eos-update-notifier
fetch-iso
# filesystem
iso-create-ml
kernel-install-for-dracut
keyserver-rank # probably not needed?
# lsb-release
nvidia-hook
nvidia-inst
pahis
paru
qemu-arm-aarch64-static-bin
rami
reflector-bash-completion
reflector-simple
welcome
# yad # patch no more needed?
yay
)
_PKGNAMES_FROM_AUR=()
PKGNAMES+=("${_PKGNAMES_FROM_AUR[@]}")
# Use option --pkgnames for special checks! For example: assets.make -n --pkgnames=akm,welcome
# PKGNAMES_WAIT specifies which of the packages in PKGNAMES will not be built.
# Formats supported:
# 'package-name' skips all versions of 'package-name'
# 'package-name|pkgver-pkgrel' skips a specific version of 'package-name'
# 'package-name|version-head*' trailing '*' matches any tail in version when skipping versions of 'package-name'
# See also: assets.make, IsInWaitList()
# Examples:
# 'eos-lxdm-gtk3'
# 'eos-lxdm-gtk3|0.5.3-5'
# 'eos-lxdm-gtk3|0.5.*'
# Note: include the definition in quotes because of the pipe character '|'.
#
PKGNAMES_WAIT=(
calamares
eos-settings-cosmic
eos-settings-sway
eos-sway-tools
# 'ckbcomp|1.233-1' # in comparison to 1.228-1, this version has no changes to the 'ckbcomp' app
# filesystem
# lsb-release
)
declare -A PKG_MAKEPKG_OPTIONS=(
eos-dracut "--nodeps"
eos-lightdm-slick-theme "--nodeps"
eos-sddm-theme "--nodeps"
eos-settings-plasma "--nodeps"
kernel-install-for-dracut "--nodeps"
eos-quickstart "--rmdeps"
yay "--rmdeps"
# calamares "--nodeps"
)
# Hook functions are run in the beginning after RationalityTests in assets.make.
# There may be several hook functions.
local ASSET_HOOKS=(
# currently none
)
# Package hooks
# Useful functions
_common_show_version() {
if [ "$localversion" != "$dev_version" ] ; then
echo -n "[dev=$dev_version] " >&2
fi
}
_Get_pkgver() {
local Pkgbuild="$1"
# grep "^pkgver=" "$Pkgbuild" | cut -d '=' -f 2 | sed "s|^[\"']\(.*\)[\"']$|\1|"
local Pkgver=""
GetPkgbuildValue "$Pkgbuild" Pkgver "pkgver"
echo "$Pkgver"
}
_fetch_that_file() {
local file="$1"
local url="$2"
[ -n "$file" ] || return 1
[ -n "$url" ] || return 1
if false ; then
local out=()
[ "$file" != "-" ] && out=(--output "$file")
curl --silent --location --max-time 10 "${out[@]}" "$url"
else
wget -q --timeout=10 -O"$file" "$url"
fi
}
__generic_get_pkgname() { local funcname="$1" ; echo "$funcname" | cut -d '_' -f 2 ; }
InstallNeededPackages() {
local pkg install=()
for pkg in "$@" ; do
pacman -Qq "$pkg" >& /dev/null || install+=("$pkg")
done
if [ ${#install[@]} -gt 0 ] ; then
printf "\n==> Installing packages: %s\n" "${install[*]}" >&2
su-c_wrapper pacman -S "${install[@]}"
fi
}
# 2022-Feb-19: added temporary hooks for *-bin ==> non-bin, remove e.g. 2 months after both packages have updated ??
_dracut_hook() {
# Inform if the Arch version if not older than the EndeavourOS version
local pkg
pkg=$(__generic_get_pkgname "${FUNCNAME[0]}")
local PKGBUILD="$PKGBUILD_ROOTDIR/$pkg/PKGBUILD"
local eos_pkgver=""
local eos_pkgrel=""
GetPkgbuildValue "$PKGBUILD" eos_pkgver "pkgver" eos_pkgrel "pkgrel"
local extra_ver eos_ver
extra_ver=$(expac -S %v "extra/$pkg")
eos_ver="${eos_pkgver}-$eos_pkgrel"
if [ "$(vercmp "$extra_ver" "$eos_ver")" -ge 0 ] ; then
Color2 info
echo2 -n "[info: ${FUNCNAME[0]}: extra/$pkg $extra_ver > endeavouros/$eos_ver] "
Color2 reset
fi
}
_paru_hook() {
local PKGBUILD
PKGBUILD="$PKGBUILD_ROOTDIR"/"$(__generic_get_pkgname "${FUNCNAME[0]}")"/PKGBUILD
local Pkgver="" # =$(grep ^pkgver= "$PKGBUILD" | cut -d'=' -f2)
local Pkgrel="" # =$(grep ^pkgrel= "$PKGBUILD" | cut -d'=' -f2)
GetPkgbuildValue "$PKGBUILD" Pkgver "pkgver"
GetPkgbuildValue "$PKGBUILD" Pkgrel "pkgrel"
case "${Pkgver}-$Pkgrel" in
2.1.0-2)
sed -i "$PKGBUILD" \
-e 's|^pkgrel=2|pkgrel=2.1|'
;;
esac
}
PickPkgbuildValue() {
local PkgbuildDir="$1"
local itemname="$2"
pushd "$PkgbuildDir" >/dev/null || return 1
ShowPkgbuildValue "$itemname"
popd >/dev/null || return 1
}
_downgrade_hook_check_latest() {
# check if AUR PKGBUILD has the latest version of downgrade from the developer
local tool=downgrade
local url=https://github.com/pbrisbin/$tool/releases
local tmpdata
local Pkgbuild="$PKGBUILD_ROOTDIR"/$tool/PKGBUILD
local localversion
localversion=$(_Get_pkgver "$Pkgbuild")
local dev_version
local Pkgrel
Pkgrel=$(PickPkgbuildValue "$PKGBUILD_ROOTDIR/$tool" pkgrel)
local AUR_version
AUR_version=$(LANG=C yay --aur -Si downgrade | grep ^Version | awk '{print $NF}')
if [ "${localversion}-$Pkgrel" != "$AUR_version" ] ; then
_aur_show_version
fi
tmpdata=$(curl -Lsm 10 "$url") || {
echo "cannot fetch info about $tool" >&2
return 1
}
dev_version="$(echo "$tmpdata" | grep -Pm1 'title="v[^"]+"')"
dev_version="$(echo "$dev_version" | sed -E -e 's|.*title="v||' -e 's|([^"]+)".*|\1|')"
_common_show_version
}
_aur_show_version() {
if [ "$localversion" != "$AUR_version" ] ; then
echo -n "[AUR=$AUR_version] " >&2
fi
}
# Common helper functions.
_yad_hook() {
local -r url=https://gitlab.archlinux.org/archlinux/packaging/packages
local -r delay=1
if wget --timeout $delay -qO /dev/null $url ; then
return 0
else
WARN "cannot fetch yad PKGBUILD!"
return 1
fi
}
GetAurVersion() {
local pname="$1"
# echo2 -n "[$FUNCNAME: $aur_src] "
## shellcheck disable=2154
case "$aur_src" in # aur_src value is set in assets.make
aur)
local helper=/bin/yay
[ -x $helper ] || helper=/bin/paru
[ -x $helper ] || return 1
LANG=C $helper -Sia "$pname" | grep ^Version | awk '{print $NF}'
;;
local | *)
local Pkgbuild="$AURSRCDIR/$REPONAME/$pname/PKGBUILD"
if [ -e "$Pkgbuild" ] ; then
# shellcheck disable=1090
pushd "${Pkgbuild%/PKGBUILD}" || return 1
# source "$Pkgbuild"
ShowPkgbuildValue pkgver pkgrel
popd
echo -n "$pkgver"-"$pkgrel"
else
WARN "file '$Pkgbuild' not found!"
return 1
fi
;;
esac
}
_ckbcomp_updatehook() {
local -r pname=ckbcomp
if [ ! -x /bin/$pname ] ; then
echo2 -n "[error: package $pname is not installed but needed by the fast update] "
return 2
fi
local url_pkgname="https://salsa.debian.org/installer-team/console-setup/raw/master/Keyboard/$pname"
local ret=0 # assume changes exist
local tmpfile=$(mktemp)
if ! curl --fail -Lsm 30 -o$tmpfile "$url_pkgname" ; then
echo2 "[error: fast update check failed]"
ret=3
elif diff $tmpfile /bin/$pname >/dev/null ; then
local aver=$(GetAurVersion $pname)
local Pkgbuild="$PKGBUILD_ROOTDIR"/$pname/PKGBUILD
local ver=$(grep ^pkgver= $Pkgbuild | cut -d'=' -f2)
ver+="-$(grep ^pkgrel= $Pkgbuild | cut -d'=' -f2)"
Color2 info
echo -n "info: $aver equals $ver"
Color2 reset
ret=1
fi
rm -f $tmpfile
return $ret
}
# Special hooks. Implemented via package hooks.
_assets_download_break() {
return 0 # same contents under different asset tags, so always break after first download
}
ASSET_FAST_UPDATE_CHECKS=(
# hook returns:
# 0 when update exists
# 1 on no update
# 2 if cannot make the check (e.g. due to a non-installed package)
# 3 on error
ckbcomp _ckbcomp_updatehook
)
declare -A ASSET_PACKAGE_HOOKS=(
assets_mirrors _assets_download_break # special hook
downgrade _downgrade_hook_check_latest
dracut _dracut_hook # Inform if the Arch version if not older than the EndeavourOS version
yad _yad_hook
# bashdb _bashdb_hook # no more needed
# budgie-control-center _budgie-control-center_hook
# eos-lightdm-gtk-theme _eos-lightdm-gtk-theme_hook # Clone package source of eos-lightdm-gtk-theme from EndeavourOS ARM
# inxi _inxi_hook_check_latest
# kalu _kalu_hook_fix_files
# nvidia-installer-db _nvidia-installer-db_hook
# paper-icon-theme-git _paper-icon-theme-git_hook
# paru _paru_hook
# rate-mirrors _rate-mirrors_hook
# yay _yay_hook
)