mirror of
https://github.com/endeavouros-team/eos-pkgbuild-setup.git
synced 2026-06-13 01:54:36 +00:00
moved files here from PKGBUILDS/eos-pkgbuild-setup
This commit is contained in:
Executable
+21
@@ -0,0 +1,21 @@
|
||||
|
||||
# Implements common package() function for PKGBUILD files by
|
||||
# standardizing certain file names.
|
||||
|
||||
Package() {
|
||||
local src name
|
||||
for src in "${source[@]}" ; do
|
||||
name=${src##*/}
|
||||
case "$name" in
|
||||
*.bash-completion) install -Dm644 $name $pkgdir/usr/share/bash-completion/completions/${name%.*} ;;
|
||||
*.conf) install -Dm644 $name $pkgdir/etc/$name ;;
|
||||
*.hook) install -Dm644 $name $pkgdir/usr/share/libalpm/hooks/$name ;;
|
||||
*.timer) install -Dm644 $name $pkgdir/usr/lib/systemd/system/$name ;;
|
||||
*.service) install -Dm644 $name $pkgdir/usr/lib/systemd/system/$name ;;
|
||||
autostart-*.desktop) install -Dm644 $name $pkgdir/etc/xdg/autostart/$name ;;
|
||||
*.desktop) install -Dm644 $name $pkgdir/usr/share/applications/$name ;;
|
||||
*.*) echo "Sorry, $name not supported." ;;
|
||||
*) install -Dm755 $name $pkgdir/usr/bin/$name ;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
@@ -1 +1,25 @@
|
||||
# eos-pkgbuild-setup
|
||||
# EOS pkgbuild setup
|
||||
|
||||
The package build process relies mainly on github release assets instead of git folders. However, both are used for saving the built packages and can be used directly as pacman repositories.<br>
|
||||
Although git folders are faster and easier to manage, they will (eventually) consume much more space than release assets.
|
||||
|
||||
## Apps and files involved in building EOS packages.
|
||||
|
||||
These are the main parts of the build process.
|
||||
|
||||
Name | Description | Parameters
|
||||
---- | ------- | ------
|
||||
EndeavourOS-packages-buildlist | Lists the names of packages (=folders of packages!) to build. | -
|
||||
assets.make | The main app to build EOS packages. Builds both native EndeavourOS packages, and packages adapted from the AUR. |
|
||||
assets.conf.\* | Configuration files required for building EOS packages. Binds package list and the build tool above.<br>File naming: assets.conf.\<repo-folder-name\>.\<release-tag\> | -
|
||||
eos-pkgbuild-setup | Creates an environment (a build folder) for building EOS packages. | -
|
||||
|
||||
## Apps purely for managing github release assets
|
||||
|
||||
These are still used as a part of the build process, but they are not needed by the users of the repo packages.
|
||||
|
||||
Name | Description | Parameters
|
||||
---- | ------- | ------
|
||||
add-release-assets | Uploads selected files to repo's release assets at github. | TAG asset(s)<br>Note: assets with file paths.
|
||||
delete-release-assets | Deletes selected release assets from a repo. | TAG asset(s)<br>Note: assets without file paths.
|
||||
release-asset-names | Shows the names of the release assets. |
|
||||
|
||||
Executable
+84
@@ -0,0 +1,84 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Add release assets (any files) to an existing tagged release in a github repo.
|
||||
#
|
||||
# Usage:
|
||||
# add-release-assets TAG asset-files
|
||||
# where
|
||||
# TAG the github release tag (find your git repo tags with command: hub release)
|
||||
# asset-files the assets to add
|
||||
#
|
||||
# Example:
|
||||
# cd /mygitrepo
|
||||
# add-release-assets v1.0 /mygitrepoassets/*
|
||||
# would add all files under /myrepoassets to github for the corresponding repo at /mygitrepo.
|
||||
#
|
||||
# Note1: requires packages 'hub' (and 'git') to be installed.
|
||||
# Note2: working folder must be the github repo folder, not the assets folder.
|
||||
# Note3: adding an already existing asset (file with the same name) simply overwrites the old one.
|
||||
#
|
||||
# The assets can be downloaded from:
|
||||
# https://github.com/USER/REPONAME/releases/download/TAG
|
||||
|
||||
DIE() {
|
||||
echo "ERROR: ""$1" >&2
|
||||
echo "Usage: $0 TAG asset(s)" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
Main() {
|
||||
local quietly=no
|
||||
if [ "$1" = "--quietly" ] ; then
|
||||
quietly=yes
|
||||
shift
|
||||
fi
|
||||
local TAG="$1"
|
||||
test -n "$TAG" || DIE "TAG is missing."
|
||||
test -n "$2" || DIE "assets are missing."
|
||||
|
||||
shift 1 # rest of the parameters are the assets
|
||||
|
||||
local xx
|
||||
for xx in hub git ; do
|
||||
test -x /usr/bin/$xx || DIE "required package '$xx' is not installed."
|
||||
done
|
||||
local asset
|
||||
local assets=()
|
||||
local existing_tags
|
||||
|
||||
# Note: we do this in the git folder, not in the asset folder
|
||||
|
||||
existing_tags="$(hub release)"
|
||||
test -n "$existing_tags" || DIE "no existing release tags were found!"
|
||||
|
||||
for xx in $existing_tags ; do
|
||||
test "$TAG" = "$xx" && break
|
||||
done
|
||||
test "$TAG" = "$xx" || DIE "TAG '$TAG' is not in existing tags [$existing_tags]"
|
||||
|
||||
if [ 1 -eq 1 ] ; then
|
||||
for asset in "$@" ; do
|
||||
test -r "$asset" || DIE "asset '$asset' does not exist."
|
||||
assets+=("-a" "$asset")
|
||||
[ $quietly = no ] && echo "adding asset $(basename "$asset")" >&2
|
||||
done
|
||||
if [ $quietly = no ] ; then
|
||||
hub release edit "${assets[@]}" -m "" "$TAG"
|
||||
else
|
||||
hub release edit "${assets[@]}" -m "" "$TAG" 2> /dev/null
|
||||
fi
|
||||
else
|
||||
for asset in "$@" ; do
|
||||
test -r "$asset" || DIE "asset '$asset' does not exist."
|
||||
if [ -z "$(release-asset-names "$TAG" "$asset")" ] ; then
|
||||
[ $quietly = no ] && echo "adding asset $(basename "$asset") to '$TAG'" >&2
|
||||
hub release edit -a "$asset" -m "" "$TAG"
|
||||
sleep 0.5
|
||||
else
|
||||
DIE "asset '$asset' already exists at github!?"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
Main "$@"
|
||||
@@ -0,0 +1,31 @@
|
||||
# bash completion for *-release-assets -*- shell-script -*-
|
||||
|
||||
_add_release_assets() {
|
||||
local cur prev #words cword split
|
||||
_init_completion -s || return
|
||||
|
||||
# Handle options that need sub-options.
|
||||
# Each option "case" should return immediately.
|
||||
|
||||
# case "$prev" in
|
||||
# --*)
|
||||
# return
|
||||
# ;;
|
||||
# esac
|
||||
|
||||
# Handle top-level options.
|
||||
# Command 'add-release-assets --show-params' shows all available parameters.
|
||||
|
||||
case "$cur" in
|
||||
# -* | "")
|
||||
# Any option or no parameters.
|
||||
# ;;
|
||||
*)
|
||||
# A non-option parameter given.
|
||||
COMPREPLY=( $(compgen -W "$(/usr/bin/hub release)" -- "$cur") )
|
||||
[[ $COMPREPLY == *= ]] && compopt -o nospace
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
complete -F _add_release_assets add-release-assets delete-release-assets download-release-assets release-asset-names
|
||||
Executable
+250
@@ -0,0 +1,250 @@
|
||||
#!/bin/bash
|
||||
|
||||
printf2() { printf "$@" >&2 ; }
|
||||
echo2() { echo "$@" >&2 ; }
|
||||
read2() { read "$@" >&2 ; }
|
||||
|
||||
FolderTests() {
|
||||
local filename_head="$1"
|
||||
local testing="$2" # yes or no
|
||||
|
||||
if [ "$(basename "$PWD")" != "PKG_ARCHIVE" ] ; then
|
||||
echo2 "You seem to be in the wrong folder, should be PKG_ARCHIVE."
|
||||
return 4
|
||||
fi
|
||||
if [ -z "$(ls -1 ${filename_head}-*.zst 2>/dev/null)" ] ; then
|
||||
[ "$testing" = "yes" ] || echo2 "You seem to be in the wrong folder, package ${filename_head}-*.zst was not found."
|
||||
return 4
|
||||
fi
|
||||
}
|
||||
|
||||
FileToTag() {
|
||||
local filename_head="$1"
|
||||
case "$filename_head" in
|
||||
welcome) tag=packages ;;
|
||||
eos-pkgbuild-setup) tag=repo-testing ;;
|
||||
esac
|
||||
}
|
||||
|
||||
Tag() {
|
||||
local available_tags
|
||||
local known_tag
|
||||
|
||||
echo "Making sure we can reach the tags."
|
||||
logstuff on
|
||||
|
||||
readarray -t available_tags <<< $(hub release)
|
||||
|
||||
for known_tag in "${available_tags[@]}" ; do
|
||||
[ "$tag" = "$known_tag" ] && break
|
||||
done
|
||||
|
||||
case "$tag" in
|
||||
"$known_tag")
|
||||
case "$tag" in
|
||||
packages)
|
||||
FolderTests welcome no || return $?
|
||||
echo2 "Using tag: $tag"
|
||||
return 0
|
||||
;;
|
||||
repo-testing)
|
||||
FolderTests eos-pkgbuild-setup no || return $?
|
||||
echo2 "Using tag: $tag"
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
read2 -p "OK to use tag '$tag'? [Y/n] "
|
||||
case "$REPLY" in
|
||||
"" | [yY]*) ;;
|
||||
*) return 1 ;;
|
||||
esac
|
||||
;;
|
||||
"")
|
||||
local xx
|
||||
for xx in eos-pkgbuild-setup welcome ; do
|
||||
if FolderTests $xx yes ; then
|
||||
FileToTag $xx
|
||||
printf2 "Based on existing file(s) ${xx}-*.zst using tag: $tag\n"
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
echo2 "Please give a tag. Available tags:"
|
||||
printf2 " %s\n" "${available_tags[@]}"
|
||||
return 2
|
||||
;;
|
||||
*)
|
||||
echo2 "Unknown tag '$tag'. Available tags:"
|
||||
printf2 " %s\n" "${available_tags[@]}"
|
||||
return 3
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
Options() {
|
||||
local progname="$(/usr/bin/basename "$0")"
|
||||
local opts
|
||||
|
||||
opts="$(/usr/bin/getopt -o=hd --longoptions help,dryrun --name "$progname" -- "$@")" || {
|
||||
Options -h
|
||||
return 1
|
||||
}
|
||||
|
||||
eval set -- "$opts"
|
||||
|
||||
while true ; do
|
||||
case "$1" in
|
||||
-d | --dryrun)
|
||||
dryrun=yes
|
||||
;;
|
||||
|
||||
-h | --help)
|
||||
cat <<EOF >&2
|
||||
Usage: $progname [options] params
|
||||
Options:
|
||||
-d, --dryrun Simulate run, don't change anything permanently.
|
||||
Params:
|
||||
tag Release assets tag at github.
|
||||
EOF
|
||||
;;
|
||||
|
||||
--) shift ; break ;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
tag="$1"
|
||||
}
|
||||
|
||||
Indent() {
|
||||
sed 's|^| |'
|
||||
}
|
||||
|
||||
AddsAndRemoves() {
|
||||
# combine local and remote, keep 5 latest of each file version
|
||||
local locals_and_remotes=$(printf "%s\n" "$locals" "$remotes" | grep -v "\.sig$" | sort -V)
|
||||
local file fileprev=""
|
||||
local pkgname pkgnameprev=""
|
||||
local files=()
|
||||
local files_to_keep=()
|
||||
local files_to_remove=()
|
||||
local -r breaker="[A-DUMMY-BREAKER]"
|
||||
local count
|
||||
|
||||
for file in $locals_and_remotes "$breaker" ; do
|
||||
[ "$file" = "$breaker" ] && break # all files checked
|
||||
[ "$file" = "$fileprev" ] && continue # remove duplicates
|
||||
|
||||
fileprev="$file"
|
||||
|
||||
pkgname=$(pkg-name-components N "$file")
|
||||
[ -z "$pkgnameprev" ] && pkgnameprev="$pkgname"
|
||||
|
||||
case "$pkgname" in
|
||||
"$pkgnameprev")
|
||||
files+=("$file")
|
||||
;;
|
||||
*)
|
||||
# pkgname changed, files full
|
||||
files_to_keep+=($(printf "%s\n" "${files[@]}" | tail -n$keep))
|
||||
count=${#files[@]}
|
||||
if [ $count -gt $keep ] ; then
|
||||
files_to_remove+=($(printf "%s\n" "${files[@]}" | head -n$((count-keep))))
|
||||
fi
|
||||
|
||||
# prepare for the next file
|
||||
pkgnameprev="$pkgname"
|
||||
files=("$file")
|
||||
esac
|
||||
done
|
||||
|
||||
# now we know which files to remove from local and remote, and keep
|
||||
|
||||
local add_remote=()
|
||||
local remove_remote=()
|
||||
local add_local=()
|
||||
local remove_local=()
|
||||
|
||||
# Note: handle .sig files now.
|
||||
|
||||
for file in "${files_to_keep[@]}" ; do
|
||||
if [ -z "$(echo "$remotes" | grep "$file")" ] ; then
|
||||
add_remote+=("$file" "$file.sig")
|
||||
fi
|
||||
|
||||
if [ -z "$(echo "$locals" | grep "$file")" ] ; then
|
||||
add_local+=("$file" "$file.sig")
|
||||
fi
|
||||
done
|
||||
for file in "${files_to_remove[@]}" ; do
|
||||
if [ -n "$(echo "$remotes" | grep "$file")" ] ; then
|
||||
remove_remote+=("$file" "$file.sig")
|
||||
fi
|
||||
|
||||
if [ -n "$(echo "$locals" | grep "$file")" ] ; then
|
||||
remove_local+=("$file" "$file.sig")
|
||||
fi
|
||||
done
|
||||
|
||||
ShowFileInfo "additions to local" "${add_local[@]}"
|
||||
ShowFileInfo "additions to remote" "${add_remote[@]}"
|
||||
ShowFileInfo "removals from local" "${remove_local[@]}"
|
||||
ShowFileInfo "removals from remote" "${remove_remote[@]}"
|
||||
|
||||
local allow=true # true or false
|
||||
|
||||
if $allow ; then
|
||||
# local adds
|
||||
if [ ${#add_local[@]} -gt 0 ] ; then
|
||||
for file in "${add_local[@]}" ; do
|
||||
download-release-assets "$tag" "$file" || return $?
|
||||
sleep 1
|
||||
done
|
||||
fi
|
||||
|
||||
# remote adds
|
||||
if [ ${#add_remote[@]} -gt 0 ] ; then
|
||||
add-release-assets "$tag" "${add_remote[@]}" || return $?
|
||||
fi
|
||||
|
||||
# local removes
|
||||
if [ ${#remove_local[@]} -gt 0 ] ; then
|
||||
rm -f "${remove_local[@]}"
|
||||
fi
|
||||
|
||||
# remote removes
|
||||
if [ ${#remove_remote[@]} -gt 0 ] ; then
|
||||
delete-release-assets --quietly "$tag" "${remove_remote[@]}" || return $?
|
||||
sleep 1
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
ShowFileInfo() {
|
||||
local msg="$1"
|
||||
shift
|
||||
local count="$#"
|
||||
|
||||
printf2 "%-5d %s\n" "$count" "$msg"
|
||||
[ $count -gt 0 ] && printf "%s\n" "$@" | Indent >&2
|
||||
}
|
||||
|
||||
FilterPackages() { grep -P '\.xz$|\.zst$' ; } # Note: exclude *.sig files for now.
|
||||
|
||||
Main() {
|
||||
local tag=""
|
||||
local dryrun=no
|
||||
local keep=5 # keeps max 5 of each package
|
||||
local locals=""
|
||||
local remotes=""
|
||||
|
||||
Options "$@"
|
||||
|
||||
Tag || return $?
|
||||
|
||||
locals=$(/usr/bin/ls -1 | FilterPackages)
|
||||
remotes=$(release-asset-names "$tag" | FilterPackages)
|
||||
|
||||
AddsAndRemoves || return $?
|
||||
}
|
||||
|
||||
Main "$@"
|
||||
@@ -0,0 +1,83 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Definitions for the [endeavouros_calamares] repo at 'mirrors'.
|
||||
|
||||
# Note: this file will be sourced into a function,
|
||||
# so all variables are made 'local'.
|
||||
|
||||
local REPONAME="endeavouros_calamares"
|
||||
local RELEASE_TAGS=(endeavouros_calamares)
|
||||
|
||||
# user to sign packages
|
||||
local SIGNER="EndeavourOS"
|
||||
|
||||
# general options
|
||||
local USE_RELEASE_ASSETS="yes" # either 'release assets' or "ordinary" github files
|
||||
local REPO_COMPRESSOR=zst # xz (=default) or zst
|
||||
|
||||
# local folders
|
||||
local ASSETSDIR="$PWD"
|
||||
local PKGBUILD_ROOTDIR="$ASSETSDIR/PKGBUILDS" # temporary copy only, will always be overwritten
|
||||
local GITDIR="$ASSETSDIR/../../mirrors" # not $REPONAME...
|
||||
|
||||
# package name specifications
|
||||
local PKGNAMES=( # actually: dir names for packages
|
||||
#aur/mkinitcpio-openswap # openswap: EOS has a minor change
|
||||
|
||||
# calamares_august_2020 # no need for this anymore
|
||||
# calamares_next
|
||||
#calamares_offline_online
|
||||
)
|
||||
|
||||
# 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
|
||||
|
||||
_calamares_next_change_pkgname() {
|
||||
local Pkgbuild="$PKGBUILD_ROOTDIR"/calamares_next/PKGBUILD
|
||||
sed -i "$Pkgbuild" -e 's|^pkgname=calamares_current$|pkgname=calamares_next|'
|
||||
}
|
||||
|
||||
_mkinitcpio-openswap_change_pkgrel() {
|
||||
# Change 'pkgrel' from 3 to 4.
|
||||
# NOTE: changing 'pkgrel' should be removed asap!
|
||||
|
||||
local Dirname=mkinitcpio-openswap
|
||||
local Pkgbuild="$PKGBUILD_ROOTDIR"/$Dirname/PKGBUILD
|
||||
local Pkgrel="$(grep ^pkgrel= "$Pkgbuild" | cut -d '=' -f 2)"
|
||||
local rel_changed=no
|
||||
local changes=""
|
||||
|
||||
case "$Pkgrel" in
|
||||
3) Pkgrel=4 ; rel_changed=yes ;;
|
||||
esac
|
||||
sed -i "$Pkgbuild" \
|
||||
-e "s|^pkgrel=.*$|pkgrel=$Pkgrel|" \
|
||||
-e 's|^\(install=.*\)$|# \1 # Just messages echoing|' \
|
||||
-e 's|^# Maintainer|# OLD Maintainer|' \
|
||||
-e 1'i# Maintainer: EndeavourOS-Team <info@endeavouros.com>\n'
|
||||
sed -i "$Pkgbuild" \
|
||||
-e '/^pkgname=.*$/i\
|
||||
'
|
||||
|
||||
local reffile="$HOME/EOS/PKGBUILDS/openswap/PKGBUILD"
|
||||
if [ -r "$reffile" ] ; then
|
||||
changes="$(diff "$Pkgbuild" "$reffile")"
|
||||
if [ "$rel_changed" = "yes" ] ; then
|
||||
changes="$(echo "$changes" | grep -v pkgrel= | grep -v "^\-\-\-" | grep -vP [0-9]*c[0-9]*)"
|
||||
fi
|
||||
if [ -n "$changes" ] ; then
|
||||
echo "$Dirname: PKGBUILD:s differ, please update!" >&2
|
||||
echo "'$changes'" >&2
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
declare -A ASSET_PACKAGE_HOOKS
|
||||
ASSET_PACKAGE_HOOKS["mkinitcpio-openswap"]=_mkinitcpio-openswap_change_pkgrel
|
||||
ASSET_PACKAGE_HOOKS["calamares_next"]=_calamares_next_change_pkgname
|
||||
@@ -0,0 +1,822 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Definitions for the [endeavouros] repo at 'mirrors'.
|
||||
|
||||
# Note: this file will be sourced into a function,
|
||||
# so all variables are made 'local'.
|
||||
|
||||
local REPONAME="endeavouros"
|
||||
local RELEASE_TAGS=(
|
||||
endeavouros
|
||||
# mirror1
|
||||
# mirror2
|
||||
)
|
||||
|
||||
# user to sign packages
|
||||
local SIGNER="EndeavourOS"
|
||||
|
||||
# general options
|
||||
local USE_GENERATED_FILELIST="no" # may generate 'repofiles.txt' into the repo
|
||||
# local USE_RELEASE_ASSETS="no" # either 'release assets' or "ordinary" github files
|
||||
local USE_RELEASE_ASSETS="yes" # either 'release assets' or "ordinary" github files
|
||||
local PREFER_GIT_OVER_RELEASE=yes
|
||||
|
||||
# local folders
|
||||
local ASSETSDIR="$PWD"
|
||||
local PKGBUILD_ROOTDIR="$ASSETSDIR/PKGBUILDS" # temporary copy only, will always be overwritten
|
||||
local GITDIR="$ASSETSDIR/../../repo" # not $REPONAME...
|
||||
|
||||
export MAKEPKG_CLEANUP=yes # some of *our* PKGBUILD files (e.g. yay) may use this!
|
||||
|
||||
local ARCHIVE_GIT="$ASSETSDIR/../../archive/.git"
|
||||
local ARCHIVE_TAG=packages
|
||||
|
||||
# new way with absolute paths:
|
||||
ASSETSDIR="$EOS_ROOT/_BUILD_/$REPONAME"
|
||||
PKGBUILD_ROOTDIR="$ASSETSDIR/PKGBUILDS"
|
||||
GITDIR="$EOS_ROOT/repo"
|
||||
ARCHIVE_GIT="$EOS_ROOT/archive/.git"
|
||||
|
||||
# source EndeavourOS-packages-buildlist || exit 1
|
||||
|
||||
# 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
|
||||
arc-gtk-theme-eos
|
||||
#arc-x-icons-theme/aur
|
||||
|
||||
bashdb/aur
|
||||
|
||||
calamares
|
||||
|
||||
ckbcomp
|
||||
|
||||
downgrade/aur
|
||||
# dracut
|
||||
|
||||
endeavouros-keyring
|
||||
endeavouros-mirrorlist
|
||||
|
||||
endeavouros-skel-default
|
||||
endeavouros-skel-i3wm
|
||||
endeavouros-skel-xfce4
|
||||
|
||||
endeavouros-theming
|
||||
endeavouros-xfce4-terminal-colors
|
||||
|
||||
eos-apps-info
|
||||
eos-bash-shared
|
||||
eos-downgrade
|
||||
eos-dracut # was: dracut-hook/aur
|
||||
eos-hooks
|
||||
eos-lightdm-gtk-theme
|
||||
eos-lightdm-slick-theme
|
||||
eos-log-tool
|
||||
eos-lxdm-gtk3
|
||||
eos-packagelist
|
||||
eos-plasma-sddm-config
|
||||
eos-qogir-icons
|
||||
eos-quickstart
|
||||
eos-rankmirrors
|
||||
eos-sddm-theme
|
||||
|
||||
eos-settings-budgie
|
||||
eos-settings-cinnamon
|
||||
eos-settings-gnome
|
||||
eos-settings-lxde
|
||||
eos-settings-lxqt
|
||||
eos-settings-mate
|
||||
eos-settings-plasma
|
||||
|
||||
eos-skel-ce-awesome
|
||||
eos-skel-ce-bspwm
|
||||
eos-skel-ce-openbox
|
||||
eos-skel-ce-qtile
|
||||
eos-skel-ce-sway
|
||||
eos-skel-ce-worm
|
||||
|
||||
eos-translations
|
||||
eos-update-notifier
|
||||
|
||||
filesystem
|
||||
|
||||
kernel-install-for-dracut
|
||||
keyserver-rank
|
||||
|
||||
lsb-release
|
||||
|
||||
mkinitcpio-openswap/aur
|
||||
|
||||
nvidia-hook
|
||||
nvidia-inst
|
||||
nvidia-installer-common
|
||||
|
||||
pahis
|
||||
#paper-icon-theme
|
||||
paru/aur
|
||||
|
||||
qemu-arm-aarch64-static-bin
|
||||
|
||||
rate-mirrors/aur
|
||||
reflector-bash-completion
|
||||
reflector-simple
|
||||
|
||||
welcome
|
||||
wgetpaste-eos
|
||||
worm/aur
|
||||
|
||||
yad
|
||||
yay/aur
|
||||
|
||||
zfs-dkms/aur
|
||||
zfs-utils/aur
|
||||
)
|
||||
|
||||
# Use option --pkgnames="names" for special checks!
|
||||
|
||||
|
||||
# PKGNAMES_WAIT specifies which of the packages in PKGNAMES will not be built.
|
||||
# Include them in quotes because we use the pipe character '|' to separate package name and the version.
|
||||
# Also add the version to skip, like 'pkgname|version-to-skip', e.g. 'eos-lxdm-gtk3|0.5.3-5'.
|
||||
# If all versions of a package should be in wait mode, write only the package name, e.g. 'eos-lxdm-gtk3'.
|
||||
#
|
||||
PKGNAMES_WAIT=(
|
||||
filesystem
|
||||
lsb-release
|
||||
)
|
||||
|
||||
|
||||
|
||||
declare -A PKG_CHANGELOGS=(
|
||||
bashdb "https://aur.archlinux.org/cgit/aur.git/log/?h=bashdb"
|
||||
downgrade "https://github.com/archlinux-downgrade/downgrade/blob/main/CHANGELOG.md"
|
||||
eos-bash-shared "https://github.com/endeavouros-team/eos-bash-shared/commits"
|
||||
filesystem "https://gitlab.archlinux.org/archlinux/packaging/packages/filesystem/-/commits"
|
||||
lsb-release "https://gitlab.archlinux.org/archlinux/packaging/packages/lsb-release/-/commits/main"
|
||||
mkinitcpio-openswap "https://aur.archlinux.org/cgit/aur.git/log/?h=mkinitcpio-openswap"
|
||||
paru "https://github.com/Morganamilo/paru/releases"
|
||||
rate-mirrors "https://github.com/westandskif/rate-mirrors/releases"
|
||||
yad "https://github.com/v1cont/yad/blob/master/NEWS"
|
||||
yay "https://github.com/Jguer/yay/releases"
|
||||
welcome "https://github.com/endeavouros-team/welcome/commits"
|
||||
zfs-dkms "https://github.com/openzfs/zfs/releases"
|
||||
zfs-utils "https://github.com/openzfs/zfs/releases"
|
||||
)
|
||||
|
||||
|
||||
# HAS_GIT_VER array incldues packages whose pkgver can be anything, i.e. newer package can have lower pkgver.
|
||||
# Sometimes e.g. -git packages have that property.
|
||||
# declare -A HAS_GIT_PKGVER # allow any pkgver value if "yes"
|
||||
# HAS_GIT_PKGVER[???-git]=yes
|
||||
|
||||
|
||||
declare -A PKG_MAKEPKG_OPTIONS=(
|
||||
endeavouros-skel-i3wm "--nodeps"
|
||||
endeavouros-skel-xfce4 "--nodeps"
|
||||
eos-dracut "--nodeps"
|
||||
eos-lightdm-slick-theme "--nodeps"
|
||||
eos-plasma-sddm-config "--nodeps"
|
||||
eos-sddm-theme "--nodeps"
|
||||
eos-settings-plasma "--nodeps"
|
||||
kernel-install-for-dracut "--nodeps"
|
||||
eos-quickstart "--rmdeps"
|
||||
worm "--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
|
||||
|
||||
# do this for: icon-themes?
|
||||
|
||||
wget() {
|
||||
local wget1=/usr/local/bin/wget.workaround
|
||||
local wget2=/usr/bin/wget
|
||||
|
||||
if [ -x $wget1 ] ; then
|
||||
$wget1 "$@"
|
||||
else
|
||||
$wget2 "$@"
|
||||
fi
|
||||
}
|
||||
export -f wget
|
||||
|
||||
|
||||
_common_show_version() {
|
||||
if [ "$localversion" != "$dev_version" ] ; then
|
||||
echo -n "[dev=$dev_version] " >&2
|
||||
fi
|
||||
}
|
||||
|
||||
_Updpkgsums() {
|
||||
local Pkgbuild="$1"
|
||||
updpkgsums "$Pkgbuild" 2>/dev/null
|
||||
}
|
||||
|
||||
_Get_pkgver() {
|
||||
local Pkgbuild="$1"
|
||||
# grep "^pkgver=" "$Pkgbuild" | cut -d '=' -f 2 | sed "s|^[\"']\(.*\)[\"']$|\1|"
|
||||
local val=""
|
||||
GetPkgbuildValue "$Pkgbuild" pkgver val
|
||||
echo "$val"
|
||||
}
|
||||
|
||||
#_GetSource0() {
|
||||
# local Pkgbuild="$1"
|
||||
# source "$Pkgbuild"
|
||||
# echo "${source[0]}"
|
||||
#}
|
||||
|
||||
_fetch_that_file() {
|
||||
local file="$1"
|
||||
local url="$2"
|
||||
|
||||
[ -n "$file" ] || return 1
|
||||
[ -n "$url" ] || return 1
|
||||
|
||||
if [ 0 -eq 1 ] ; 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
|
||||
}
|
||||
|
||||
_budgie-control-center_hook() {
|
||||
local pkgs=(
|
||||
modemmanager
|
||||
# gnome-online-accounts
|
||||
# gsound
|
||||
budgie-desktop
|
||||
# libcheese
|
||||
# colord-gtk
|
||||
)
|
||||
|
||||
InstallNeededPackages "${pkgs[@]}"
|
||||
}
|
||||
|
||||
|
||||
|
||||
# 2022-Feb-19: added temporary hooks for *-bin ==> non-bin, remove e.g. 2 months after both packages have updated ??
|
||||
|
||||
_rate-mirrors_hook() {
|
||||
local PKGBUILD="$PKGBUILD_ROOTDIR"/"$(__generic_get_pkgname $FUNCNAME)"/PKGBUILD
|
||||
sed -i $PKGBUILD \
|
||||
-e "/^depends=/a \ \nreplaces=(rate-mirrors-bin)"
|
||||
}
|
||||
|
||||
_dracut_hook() {
|
||||
local PKGBUILD="$PKGBUILD_ROOTDIR"/"$(__generic_get_pkgname $FUNCNAME)"/PKGBUILD
|
||||
local eos_pkgver=""
|
||||
local eos_pkgrel=""
|
||||
GetPkgbuildValue "$PKGBUILD" pkgver eos_pkgver
|
||||
GetPkgbuildValue "$PKGBUILD" pkgrel eos_pkgrel
|
||||
local extra_ver=$(expac -S %v extra/dracut)
|
||||
|
||||
if [ $(vercmp $extra_ver ${eos_pkgver}-$eos_pkgrel) -ge 0 ] ; then
|
||||
printf "$FUNCNAME: dracut: Arch version is not older than EndeavourOS ==> skip the EndeavourOS version. " >&2
|
||||
fi
|
||||
}
|
||||
|
||||
_paru_hook() {
|
||||
local PKGBUILD="$PKGBUILD_ROOTDIR"/"$(__generic_get_pkgname $FUNCNAME)"/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
|
||||
|
||||
if [ "${Pkgver}-$Pkgrel" = "1.11.1-1" ] ; then
|
||||
sed -i "$PKGBUILD" \
|
||||
-e 's|^pkgver=.*|pkgver=1.11.2|' \
|
||||
-e "s|^sha256sums=.*|sha256sums=('9fd8db52894f9e7d61a3901d2c441502aab28a090083e0d6fdb58118e53a8a14')|"
|
||||
fi
|
||||
}
|
||||
|
||||
_eos-lightdm-gtk-theme_hook() {
|
||||
# Clone package source of eos-lightdm-gtk-theme from EndeavourOS ARM
|
||||
|
||||
local Pkgname="$(__generic_get_pkgname $FUNCNAME)"
|
||||
|
||||
pushd /tmp >/dev/null || return 1
|
||||
rm -rf PKGBUILDS
|
||||
git clone https://github.com/endeavouros-arm/PKGBUILDS.git >& /dev/null || return 1 # Get all from EOS ARM.
|
||||
[ -d "$PKGBUILD_ROOTDIR"/$Pkgname ] && rm -rf "$PKGBUILD_ROOTDIR"/$Pkgname # Replace old local eos-lightdm-gtk-theme dir
|
||||
mv PKGBUILDS/$Pkgname "$PKGBUILD_ROOTDIR"/ || return 1 # with the new eos-lightdm-gtk-theme dir.
|
||||
popd >/dev/null
|
||||
rm -rf /tmp/PKGBUILDS # clean up
|
||||
}
|
||||
|
||||
_bashdb_hook() {
|
||||
local Pkgname="$(__generic_get_pkgname $FUNCNAME)"
|
||||
local Pkgbuild="$PKGBUILD_ROOTDIR"/$Pkgname/PKGBUILD
|
||||
local VER=""
|
||||
local PKGREL=""
|
||||
|
||||
GetPkgbuildValue "$Pkgbuild" _ver VER
|
||||
|
||||
# if [ "$(grep "^_ver=" "$Pkgbuild" | cut -d'=' -f2)" = "'5.0-1.1.2'" ] ; then
|
||||
if [ "$VER" = "5.0-1.1.2" ] ; then
|
||||
# support also bash version 5.1
|
||||
|
||||
local line="s/'5.0')/'5.0' | '5.1')/"
|
||||
|
||||
sed -i "$Pkgbuild" \
|
||||
-e "/^[ ]*#sed /a \ sed -i configure -e \"$line\""
|
||||
|
||||
# show in pkgrel we changed this package
|
||||
GetPkgbuildValue "$Pkgbuild" pkgrel PKGREL
|
||||
# if [ "$(grep ^pkgrel= "$Pkgbuild" | cut -d'=' -f2)" = "'1'" ] ; then
|
||||
if [ "$PKGREL" = "1" ] ; then
|
||||
sed -i "$Pkgbuild" \
|
||||
-e 's|^pkgrel=.*|pkgrel=1.1|'
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
_paper-icon-theme-git_hook() {
|
||||
local Pkgname="$(__generic_get_pkgname $FUNCNAME)"
|
||||
local Pkgbuild="$PKGBUILD_ROOTDIR"/$Pkgname/PKGBUILD
|
||||
local cleanup=""
|
||||
local commits commit
|
||||
local data=$(curl -s https://github.com/snwh/paper-icon-theme)
|
||||
|
||||
commits=$(echo "$data" | grep -B2 " commits$" | head -n1 | sed 's|[ ]*<strong>\([0-9]*\)</strong>$|\1|') # 832
|
||||
commit=$( echo "$data" | grep ">Permalink<" | sed 's|.*/tree/\([0-9a-f]*\)".*|\1|') # aa3e8af7a1f0831a51fd7e638a4acb077a1e5188
|
||||
commit=${commit::7} # aa3e8af
|
||||
|
||||
cleanup+=' local dir="$srcdir/../$pkgname"\n'
|
||||
cleanup+=' [ -d "$dir" ] && rm -rf "$dir"'
|
||||
|
||||
# Changes:
|
||||
# - remove reference to $srcdir
|
||||
# - get pkgver from github info
|
||||
# - remove pkgver()
|
||||
# - conflicts with paper-icon-theme
|
||||
# - add some cleanup
|
||||
|
||||
sed -i "$Pkgbuild" \
|
||||
-e 's|^pkgname=.*|pkgname=paper-icon-theme|' \
|
||||
-e 's|cd "$srcdir/$pkgname"$|cd "$pkgname"|' \
|
||||
-e "s|^pkgver=.*|pkgver=1.5.0.$commits.$commit|" \
|
||||
-e 's|^pkgver()|_pkgver_not_used()|' \
|
||||
-e "/^provides=(/a \conflicts=(paper-icon-theme)" \
|
||||
-e "/ ninja -C /a \ # cleanup\n$cleanup"
|
||||
|
||||
return 11 # pkgver was changed
|
||||
}
|
||||
|
||||
_ckbcomp_hook_new() {
|
||||
printf "@" >&2
|
||||
|
||||
local data=$(curl -Lsm 10 -o- https://packages.debian.org/source/sid/console-setup)
|
||||
local Pkgver=$(echo "$data" | grep metadata | head -n1 | sed -e 's|.*/console-setup_||' -e 's|_.*||')
|
||||
local PKGBUILD="$PKGBUILD_ROOTDIR"/"$(__generic_get_pkgname $FUNCNAME)"/PKGBUILD
|
||||
local new_url=https://deb.debian.org/debian/pool/main/c/console-setup/console-setup_$Pkgver.tar.xz
|
||||
sed -i "$PKGBUILD" \
|
||||
-e "/^source=.*/a \source=($new_url)"
|
||||
}
|
||||
|
||||
_ckbcomp_hook() {
|
||||
local tool=ckbcomp
|
||||
|
||||
# new version info
|
||||
local info retval
|
||||
info=$(curl --fail --silent --location --max-time 10 https://salsa.debian.org/installer-team/console-setup/-/tags)
|
||||
retval=$?
|
||||
if [ $retval -ne 0 ] ; then
|
||||
_ckbcomp_hook_new
|
||||
return
|
||||
fi
|
||||
if [ -n "$(echo "$info" | grep "503 Service Unavailable")" ] ; then
|
||||
printf "fetching info failed. " >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
local dl="https://salsa.debian.org"$(echo "$info" | grep "gl-button btn btn-sm btn-confirm" | head -n1 | sed -E -e 's|.*href="([^"]+)".*|\1|' -e 's|zip$|tar.gz|')
|
||||
local archivesuffix=""
|
||||
local namesuffix=""
|
||||
|
||||
[[ $dl =~ /archive/debian/ ]] && archivesuffix="/debian"
|
||||
[[ $dl =~ console-setup-debian ]] && namesuffix="-debian"
|
||||
|
||||
# local newver=$(echo "$info" | grep "console-setup Debian release" | head -n1 | sed -E 's|.* release ([0-9\.]+).*|\1|')
|
||||
|
||||
local newver=$(echo "$info" | grep "console-setup-.*\.tar\.gz" | head -n1)
|
||||
newver=$(echo "$newver" | sed -E 's|.*/([0-9\.]+)/.*|\1|')
|
||||
|
||||
if [ -n "$(echo "$newver" | sed 's|[0-9\.]*||g')" ] ; then
|
||||
printf "finding new version failed, got '$newver'" >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [ $(vercmp "$newver" "1.211") -le 0 ] ; then
|
||||
return # NOTE: 1.196 - 1.211: 'ckbcomp' hasn't changed!
|
||||
fi
|
||||
|
||||
# current version info
|
||||
local Pkgbuild="$PKGBUILD_ROOTDIR"/$tool/PKGBUILD
|
||||
local Pkgver=$(_Get_pkgver "$Pkgbuild")
|
||||
|
||||
[ "$newver" = "$Pkgver" ] && return
|
||||
|
||||
pushd "$PKGBUILD_ROOTDIR"/$tool >/dev/null
|
||||
|
||||
sed -i PKGBUILD \
|
||||
-e "s|^pkgver=.*|pkgver=$newver|" \
|
||||
-e "s|^source=.*|source=($dl)|" \
|
||||
-e "s|^_namesuffix=.*|_namesuffix='$namesuffix'|" \
|
||||
-e "s|^_archivesuffix=.*|_archivesuffix='$archivesuffix'|"
|
||||
|
||||
if ! updpkgsums PKGBUILD >& /dev/null ; then
|
||||
popd >/dev/null
|
||||
printf "updpkgsums failed " >&2
|
||||
return 1
|
||||
fi
|
||||
if ! makepkg -p PKGBUILD >& /dev/null ; then
|
||||
popd >/dev/null
|
||||
printf "makepkg failed " >&2
|
||||
return 1
|
||||
fi
|
||||
# cleanup makepkg stuff
|
||||
rm -rf src pkg *.zst *.xz *.gz
|
||||
|
||||
if [ ! -x /usr/bin/$tool ] ; then
|
||||
# Cannot compare with non-existing /usr/bin/ckbcomp !!!
|
||||
printf "sorry, ckbcomp is not installed, cannot compare. " >&2
|
||||
else
|
||||
if ! diff src/console-setup-$newver/Keyboard/$tool /usr/bin/$tool >& /dev/null ; then
|
||||
printf "new version $newver is available, $tool differ. " >&2
|
||||
popd >/dev/null
|
||||
return 11 # pkgver (and maybe download link) were changed
|
||||
fi
|
||||
fi
|
||||
|
||||
popd >/dev/null
|
||||
}
|
||||
|
||||
_ckbcomp_hook_old() {
|
||||
local tool=ckbcomp
|
||||
local Dstdir="$PKGBUILD_ROOTDIR"/$tool
|
||||
local Pkgbuild="$Dstdir"/PKGBUILD
|
||||
local Url="$(_GetSource0 "$Pkgbuild")"
|
||||
Url="$(dirname "$Url")"
|
||||
local newinfo="$(_fetch_that_file "-" "$Url")"
|
||||
[ -n "$newinfo" ] || { printf "Error: $tool: fetching info failed! " >&2 ; return 1 ; }
|
||||
local newbase=console-setup_
|
||||
local newver="$(echo "$newinfo" | grep $newbase | grep "\.tar\.xz" | tail -n 1 | sed "s|^.*\"$newbase\([0-9\.]*\)\.tar.*$|\1|")"
|
||||
local curver="$(_Get_pkgver "$Pkgbuild")"
|
||||
local filebase=$newbase$newver
|
||||
|
||||
if [ "$newver" != "$curver" ] ; then
|
||||
local ff
|
||||
for ff in dsc tar.xz ; do
|
||||
_fetch_that_file "$Dstdir/$filebase.$ff" "$Url"/$filebase.$ff || {
|
||||
printf "Error: $tool: fetching $filebase.$ff failed. " >&2
|
||||
return 1
|
||||
}
|
||||
done
|
||||
local sha256="$(cat "$Dstdir/$filebase.dsc" | grep -A1 ^Checksums-Sha256 | tail -n 1 | awk '{print $1}')"
|
||||
echo "$sha256 $Dstdir/$filebase.tar.xz" | sha256sum -c >& /dev/null || {
|
||||
echo "Error: $tool: sha256 for $filebase.tar.xz does not match!" >&2
|
||||
return 1
|
||||
}
|
||||
rm -f "$Dstdir/$filebase.dsc"
|
||||
sed -i "$Pkgbuild" \
|
||||
-e "s|^pkgver=.*|pkgver=$newver|"
|
||||
|
||||
case "$newver" in
|
||||
"1.199")
|
||||
sed -i "$Pkgbuild" \
|
||||
-e 's| cd console-setup-${pkgver}$| cd console-setup|'
|
||||
;;
|
||||
*)
|
||||
sed -i "$Pkgbuild" \
|
||||
-e 's| cd console-setup$| cd console-setup-$pkgver|'
|
||||
;;
|
||||
esac
|
||||
updpkgsums "$Pkgbuild" 2>/dev/null
|
||||
# echo -n "#" >&2
|
||||
return 11 # pkgver was changed
|
||||
fi
|
||||
}
|
||||
|
||||
_ckbcomp_hook_change_version_old() {
|
||||
# change "$url" http to https
|
||||
sed -i "$PKGBUILD_ROOTDIR"/ckbcomp/PKGBUILD \
|
||||
-e 's|^url="http:|url="https:|'
|
||||
}
|
||||
|
||||
_yay_hook_check_latest() {
|
||||
# check if AUR PKGBUILD has the latest version of yay from the developer
|
||||
local tool=yay
|
||||
local url=https://github.com/Jguer/$tool/releases
|
||||
local tmpdata
|
||||
local Pkgbuild="$PKGBUILD_ROOTDIR"/$tool/PKGBUILD
|
||||
local localversion=$(_Get_pkgver "$Pkgbuild")
|
||||
local dev_version
|
||||
|
||||
tmpdata="$(_fetch_that_file "-" $url)"
|
||||
if [ $? -ne 0 ] ; then
|
||||
echo "cannot fetch info about $tool" >&2
|
||||
return 1
|
||||
fi
|
||||
dev_version="$(echo "$tmpdata" | grep /Jguer/yay/tree/v | head -n 1 | sed 's|^.*/tree/v\([0-9\.]*\)" .*$|\1|')"
|
||||
|
||||
_common_show_version
|
||||
}
|
||||
|
||||
_yay_hook_check_latest_old() {
|
||||
# check if AUR PKGBUILD has the latest version of yay from the developer
|
||||
local tool=yay
|
||||
local url=https://github.com/Jguer/$tool/releases
|
||||
local tmpfile=$(mktemp)
|
||||
local Pkgbuild="$PKGBUILD_ROOTDIR"/$tool/PKGBUILD
|
||||
local localversion=$(_Get_pkgver "$Pkgbuild")
|
||||
local dev_version
|
||||
|
||||
_fetch_that_file $tmpfile $url || {
|
||||
echo "cannot fetch info about $tool" >&2
|
||||
rm -f $tmpfile
|
||||
return 1
|
||||
}
|
||||
#dev_version="$(grep "Release v[0-9]" $tmpfile | sed 's|^.*Release v\([0-9\.]*\).*$|\1|')"
|
||||
dev_version="$(grep /Jguer/yay/tree/v $tmpfile | head -n 1 | sed 's|^.*/tree/v\([0-9\.]*\)" .*$|\1|')"
|
||||
|
||||
_common_show_version
|
||||
rm -f $tmpfile
|
||||
}
|
||||
|
||||
_nvidia-installer-db_hook() {
|
||||
# nvidia-site-check-and-update-db
|
||||
return
|
||||
|
||||
# check if Nvidia has changed its driver archive (db) site
|
||||
local archive=https://www.nvidia.com/en-us/drivers/unix
|
||||
local store="$HOME"/.nvidia-installer/archive.html
|
||||
mkdir -p "$(dirname "$store")"
|
||||
local tmpfile="$(mktemp "$store".tmp.XXXXX)"
|
||||
|
||||
_fetch_that_file "$tmpfile" $archive || {
|
||||
rm -f "$tmpfile"
|
||||
return 1
|
||||
}
|
||||
if (diff "$tmpfile" "$store" >& /dev/null) ; then
|
||||
rm -f "$store".tmp.* # no diffs
|
||||
else
|
||||
mv "$store" "$store".tmp
|
||||
mv "$tmpfile" "$store"
|
||||
mv "$store".tmp "$tmpfile"
|
||||
printf "$archive changed! Run nvidia-installer-check to see if there's a problem. " >&2
|
||||
fi
|
||||
}
|
||||
|
||||
_inxi_hook_check_latest() {
|
||||
# check if AUR PKGBUILD has the latest version of inxi from the developer
|
||||
local tool=inxi
|
||||
local url=https://github.com/smxi/$tool/releases
|
||||
local tmpdata
|
||||
local Pkgbuild="$PKGBUILD_ROOTDIR"/$tool/PKGBUILD
|
||||
local localversion=$(_Get_pkgver "$Pkgbuild")
|
||||
local dev_version
|
||||
local prefer_dev_version=yes
|
||||
|
||||
tmpdata="$(_fetch_that_file - $url)"
|
||||
if [ $? -ne 0 ] ; then
|
||||
echo "cannot fetch info about $tool" >&2
|
||||
return 1
|
||||
fi
|
||||
# Inxi has a version number "conflicting" with Arch versioning. Have to change inxi's '-' to '.'.
|
||||
dev_version="$(echo "$tmpdata" | grep /smxi/inxi/releases/tag/ | head -n 1 | sed -e 's|^.*/tag/||' -e 's|".*$||' | tr '-' '.')"
|
||||
|
||||
if [ "$prefer_dev_version" = "yes" ] ; then
|
||||
sed -i $Pkgbuild -e 's|^pkgver='"$localversion"'$|pkgver='"$dev_version"'|'
|
||||
# echo -n "#" >&2
|
||||
_Updpkgsums "$Pkgbuild"
|
||||
return 11 # pkgver was changed
|
||||
else
|
||||
_common_show_version
|
||||
fi
|
||||
}
|
||||
|
||||
_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=$(_Get_pkgver "$Pkgbuild")
|
||||
local dev_version
|
||||
|
||||
tmpdata="$(_fetch_that_file - $url)"
|
||||
if [ $? -ne 0 ] ; then
|
||||
echo "cannot fetch info about $tool" >&2
|
||||
return 1
|
||||
fi
|
||||
dev_version="$(echo "$tmpdata" | grep /pbrisbin/downgrade/releases/tag/v | head -n 1 | sed 's|^.*/tag/v\([0-9\.]*\).*$|\1|')"
|
||||
|
||||
_common_show_version
|
||||
}
|
||||
|
||||
_kalu_hook_fix_files() {
|
||||
# fix kalu.install
|
||||
sed -i "$PKGBUILD_ROOTDIR"/kalu/kalu.install \
|
||||
-e 's| usr/sbin/|/usr/sbin/|'
|
||||
|
||||
# use names instead of numbers in "chown" command
|
||||
sed -i "$PKGBUILD_ROOTDIR"/kalu/PKGBUILD \
|
||||
-e 's|chown 0:102|chown root:polkitd|' \
|
||||
-e 's|^\(pkgrel=[0-9]*\)$|\1.1|'
|
||||
}
|
||||
_yad_hook_add_gspell() {
|
||||
# add gspell to 'depends', and modify 'pkgrel'
|
||||
sed -i "$PKGBUILD_ROOTDIR"/yad/PKGBUILD \
|
||||
-e 's|^depends=(\([^\)]*\))$|depends=(\1 gspell)|' \
|
||||
-e 's|^\(pkgrel=[0-9]*\)$|\1.1|'
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
# Common helper functions.
|
||||
|
||||
_helper_get_files_from_Arch() {
|
||||
local PKGNAME="$1" # must include "repo/" prefix, e.g. "extra/yad"
|
||||
|
||||
case "$PKGNAME" in
|
||||
*/*) ;;
|
||||
*) return 1 ;;
|
||||
esac
|
||||
|
||||
local tmpdir=$(mktemp -d)
|
||||
pushd $tmpdir >/dev/null
|
||||
yay -G $PKGNAME || return 1
|
||||
popd >/dev/null
|
||||
mv $tmpdir/$PKGNAME/trunk/* . || return 1
|
||||
rm -rf $tmpdir
|
||||
}
|
||||
_helper_compare_pkg_version_info() {
|
||||
# Compare pkgver and pkgrel of Arch and EOS PKGBUILDs.
|
||||
# If changed, manual intervention is needed: simply update PKGBUILD in EOS with new from Arch.
|
||||
|
||||
local PKGNAME="$1"
|
||||
|
||||
local -r ver1="$(grep "^pkgver=" PKGBUILD)"
|
||||
local -r rel1="$(grep "^pkgrel=" PKGBUILD | sed 's|\.1$||')"
|
||||
local -r ver2="$(grep "^pkgver=" PKGBUILD.eos)"
|
||||
local -r rel2="$(grep "^pkgrel=" PKGBUILD.eos | sed 's|\.1$||')"
|
||||
[ "$ver1" = "$ver2" ] || { echo "NOTE: $PKGNAME PKGBUILD (pkgver) has changed, manual intervention needed!" >&2; return 1; }
|
||||
[ "$rel1" = "$rel2" ] || { echo "NOTE: $PKGNAME PKGBUILD (pkgrel) has changed, manual intervention needed!" >&2; return 1; }
|
||||
}
|
||||
_helper_eos_branding_and_marking() {
|
||||
# - append ".eos" to 'pkgver' value to mark EOS changes
|
||||
# - add the EOS maintainer line
|
||||
# - update checksums because some files were changed here
|
||||
|
||||
sed -i PKGBUILD -e "s|^\(pkgver=.*\)|\1.eos|"
|
||||
if [ -z "$(grep "Maintainer.*endeavouros" PKGBUILD)" ] ; then
|
||||
sed -i PKGBUILD -e "/^# Maintainer:/i \# Maintainer: EndeavourOS-Team <info@endeavouros.com>"
|
||||
fi
|
||||
updpkgsums PKGBUILD >& /dev/null
|
||||
}
|
||||
|
||||
|
||||
_yad_hook() {
|
||||
|
||||
return # 2023-Mar-08: currently not used!
|
||||
|
||||
|
||||
# patch the dialog height issue, see https://sourceforge.net/p/yad-dialog/tickets/322/#6f2d
|
||||
|
||||
local workdir="$PKGBUILD_ROOTDIR"/yad
|
||||
local url=https://github.com/endeavouros-team/PKGBUILDS/raw/master/yad
|
||||
|
||||
pushd "$workdir" >/dev/null
|
||||
|
||||
cp PKGBUILD PKGBUILD.eos
|
||||
|
||||
_helper_get_files_from_Arch extra/yad || return 1
|
||||
_helper_compare_pkg_version_info extra/yad || return 1
|
||||
|
||||
sed -i PKGBUILD -E \
|
||||
-e '/autoreconf -ivf/i \ # patch for the dialog height issue\n patch -u src/main.c -i ../../yad-github-issue-107.patch\n' \
|
||||
-e "s|^(sha256sums=.*)\)|\1 '9af007ad9472afc9fa24e753b30ce7b91cf2e73a37a0074a64ae01979010b30f'\)|" \
|
||||
-e "s|^(arch=.*)\)|\1 'aarch64' 'armv7'\)|" \
|
||||
-e "s|^(source=.*)\)$|\1 '$url/yad-github-issue-107.patch'\)|" \
|
||||
-e "s|^(pkgver=.*)|\1.eos|"
|
||||
|
||||
sed -i PKGBUILD \
|
||||
-e 's|${pkgver}|${pkgver%.eos}|' \
|
||||
-e '/sha256sums=/a \conflicts=(yad yad-git)\nprovides=(yad)\nreplaces=(yad-eos)'
|
||||
|
||||
_helper_eos_branding_and_marking
|
||||
|
||||
popd >/dev/null
|
||||
}
|
||||
|
||||
_diff_file_and_data() {
|
||||
local file="$1"
|
||||
local data="$2"
|
||||
local datafile="$3"
|
||||
local retval
|
||||
|
||||
echo "$data" > $datafile
|
||||
#diff "$file" "$datafile"
|
||||
meld "$file" "$datafile"
|
||||
}
|
||||
|
||||
_eos-bash-shared_hook_check_ksetwallpaper_py() {
|
||||
# Check if we have the latest version of file ksetwallpaper.py.
|
||||
# See https://github.com/pashazz/ksetwallpaper/raw/master/ksetwallpaper.py
|
||||
|
||||
local file=ksetwallpaper.py
|
||||
local url="https://github.com/pashazz/ksetwallpaper/raw/master/$file"
|
||||
local current="$PKGBUILD_ROOTDIR"/eos-bash-shared/$file # old place
|
||||
local new
|
||||
local diffs answer
|
||||
|
||||
current="$EOS_ROOT/eos-bash-shared/$file" # new place
|
||||
|
||||
new="$(_fetch_that_file - "$url")"
|
||||
if [ $? -ne 0 ] ; then
|
||||
echo "Warning: cannot fetch '$url'." >&2
|
||||
return 1
|
||||
fi
|
||||
if [ "$(cat "$current")" != "$new" ] ; then
|
||||
local newfile=$(mktemp)
|
||||
_diff_file_and_data "$current" "$new" "$newfile"
|
||||
# diffs="$(_diff_file_and_data "$current" "$new" "$newfile")"
|
||||
# echo "" >&2
|
||||
# echo "$diffs" >&2
|
||||
# echo "" >&2
|
||||
if false ; then
|
||||
read -p "eos-bash-shared: file '$file' differs from current, update (Y/n)? " answer >&2
|
||||
case "$answer" in
|
||||
"" | [yY]*)
|
||||
rm -f $current
|
||||
mv $newfile $current
|
||||
_Updpkgsums "$current"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
rm -f "$newfile"
|
||||
fi
|
||||
}
|
||||
|
||||
# Special hooks. Implemented via package hooks.
|
||||
|
||||
_assets_download_break() {
|
||||
return 0 # same contents under different asset tags, so always break after first download
|
||||
}
|
||||
|
||||
declare -A ASSET_PACKAGE_HOOKS=(
|
||||
assets_mirrors _assets_download_break # special hook
|
||||
|
||||
eos-bash-shared _eos-bash-shared_hook_check_ksetwallpaper_py
|
||||
eos-lightdm-gtk-theme _eos-lightdm-gtk-theme_hook
|
||||
paru _paru_hook
|
||||
dracut _dracut_hook
|
||||
|
||||
# bashdb _bashdb_hook # no more needed
|
||||
# budgie-control-center _budgie-control-center_hook
|
||||
# ckbcomp _ckbcomp_hook
|
||||
# ckbcomp _ckbcomp_hook_change_version
|
||||
# downgrade _downgrade_hook_check_latest
|
||||
# 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
|
||||
# rate-mirrors _rate-mirrors_hook
|
||||
# yad _yad_hook_add_gspell
|
||||
# yay _yay_hook_check_latest
|
||||
)
|
||||
@@ -0,0 +1,86 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Definitions for the [endeavouros-testing-dev] repo at 'repo-testing'.
|
||||
|
||||
# Note: this file will be sourced into a function,
|
||||
# so all variables are made 'local'.
|
||||
|
||||
local REPONAME="endeavouros-testing-dev"
|
||||
local RELEASE_TAGS=(endeavouros-pkgbuild-tools)
|
||||
|
||||
# user to sign packages
|
||||
local SIGNER="EndeavourOS"
|
||||
|
||||
# local folders
|
||||
local ASSETSDIR="$PWD"
|
||||
local PKGBUILD_ROOTDIR="$ASSETSDIR/PKGBUILDS" # temporary copy only, will always be overwritten
|
||||
#local GITDIR="$ASSETSDIR/../../repo-testing" # not $REPONAME ...
|
||||
local GITDIR="$ASSETSDIR/../../eos-tools" # not $REPONAME ...
|
||||
local USE_RELEASE_ASSETS=yes
|
||||
local PREFER_GIT_OVER_RELEASE=yes
|
||||
|
||||
#if [ "$USE_RELEASE_ASSETS" = "no" ] ; then
|
||||
local GITREPOURL=https://github.com/endeavouros-team/eos-tools.git
|
||||
local GITREPODIR="$(basename "$GITREPOURL" .git)/$REPONAME"
|
||||
#fi
|
||||
local ARCHIVE_GIT="$ASSETSDIR/../../archive/.git"
|
||||
local ARCHIVE_TAG=repo-testing
|
||||
|
||||
# new way with absolute paths:
|
||||
ASSETSDIR="$EOS_ROOT/_BUILD_/$REPONAME"
|
||||
PKGBUILD_ROOTDIR="$ASSETSDIR/PKGBUILDS" # temporary copy only, will always be overwritten
|
||||
GITDIR="$EOS_ROOT/eos-tools"
|
||||
ARCHIVE_GIT="$EOS_ROOT/archive/.git"
|
||||
|
||||
|
||||
# package name specifications
|
||||
local PKGNAMES=( # actually: dir names for packages
|
||||
b43-firmware/aur
|
||||
python3-gpg_batch_sign/aur
|
||||
repo-add_and_sign/aur
|
||||
# aur/archupdate-indicator
|
||||
|
||||
eos-pkgbuild-setup
|
||||
)
|
||||
|
||||
# Hook functions are run at the beginning of assets.make.
|
||||
local ASSET_HOOKS=(
|
||||
# currently none
|
||||
)
|
||||
|
||||
_welcome_hook_theming() {
|
||||
# don't skip theming code in repo-testing!
|
||||
pushd "$PKGBUILD_ROOTDIR"/welcome >/dev/null
|
||||
|
||||
#sed -i welcome \
|
||||
# -e 's|^[ ]*local theming_support_skip=1| local theming_support_skip=0|'
|
||||
sed -i welcome \
|
||||
-e 's|^[ ]*mode=offline| mode=choose|'
|
||||
updpkgsums 2>/dev/null
|
||||
|
||||
popd >/dev/null
|
||||
}
|
||||
|
||||
# Hooks for AUR packages:
|
||||
_repo-add_and_sign_hook_change_rel() {
|
||||
# change http to https
|
||||
sed -i "$PKGBUILD_ROOTDIR"/repo-add_and_sign/PKGBUILD \
|
||||
-e 's|http://|https://|'
|
||||
}
|
||||
_archupdate-indicator_fixes() {
|
||||
# Change pkgver in PKGBUILD.
|
||||
# Force PKGBUILD to change strings "xterm" and "sudo pacman -Syu" to "xfce4-terminal" and "ysy -Syu" in archupdate-indicator.py.
|
||||
local pkgbuild="$PKGBUILD_ROOTDIR"/archupdate-indicator/PKGBUILD
|
||||
local rel="$(grep "^pkgrel=" $pkgbuild | cut -d '=' -f 2)".1
|
||||
sed -i "$pkgbuild" \
|
||||
-e '/^[ \t]*cd "/'afoobar123
|
||||
sed -i "$pkgbuild" \
|
||||
-e 's|^pkgrel=.*$|pkgrel='"$rel"'|' \
|
||||
-e 's|foobar123|\tsed -i archupdate-indicator.py -e \"s/\\"xterm\\"/\\"xfce4-terminal\\"/\" -e \"s/\\"sudo pacman -Syu\\"/\\"yay -Syu\\"/\"|'
|
||||
}
|
||||
|
||||
declare -A ASSET_PACKAGE_HOOKS
|
||||
#ASSET_PACKAGE_HOOKS["welcome"]=_welcome_hook_theming
|
||||
ASSET_PACKAGE_HOOKS["repo-add_and_sign"]=_repo-add_and_sign_hook_change_rel
|
||||
ASSET_PACKAGE_HOOKS["archupdate-indicator"]=_archupdate-indicator_fixes
|
||||
|
||||
Executable
+1825
File diff suppressed because it is too large
Load Diff
Executable
+252
@@ -0,0 +1,252 @@
|
||||
#!/bin/bash
|
||||
|
||||
RELEASE_ASSETS_VERBOSE=yes
|
||||
|
||||
echo2() {
|
||||
echo "$@" >&2
|
||||
}
|
||||
verbose() {
|
||||
case "$RELEASE_ASSETS_VERBOSE" in
|
||||
1|yes) echo2 "$@" ;;
|
||||
esac
|
||||
}
|
||||
Usage() {
|
||||
echo2 "Usage: $(basename "$0") [--quietly] TAG asset-names"
|
||||
echo2 "where"
|
||||
echo2 " TAG release tag"
|
||||
echo2 " asset-names one or more asset names (without path) separated by space"
|
||||
echo2 " --quietly don't ask confirmation for deletions"
|
||||
}
|
||||
DIE() {
|
||||
local msg="$1"
|
||||
local file_to_delete="$2" # optional file to delete
|
||||
test -n "$file_to_delete" && rm -f "$file_to_delete"
|
||||
echo2 "ERROR: $msg"
|
||||
Usage
|
||||
exit 1
|
||||
}
|
||||
WARN() {
|
||||
local msg="$1"
|
||||
echo2 "Warning: $msg"
|
||||
}
|
||||
Info() {
|
||||
local msg="$1"
|
||||
verbose "Info: $msg"
|
||||
}
|
||||
|
||||
Prompt() { # prompt if a prompt value is given, no newline at end
|
||||
local prompt="$1"
|
||||
test -n "$prompt" && echo2 -n "$prompt: "
|
||||
}
|
||||
Promptln() { # prompt if a prompt value is given, newline at end
|
||||
local prompt="$1"
|
||||
test -n "$prompt" && echo2 "$prompt:"
|
||||
}
|
||||
|
||||
GetValueFromPipe() { # return the value from pipe's output, second token
|
||||
awk '{print $2}' | sed -e 's|^"||' -e 's|",$||' -e 's|,$||'
|
||||
}
|
||||
GetValueFromPipeAndIndent() { # return the value from pipe's output, second token and indented by four spaces
|
||||
awk '{print $2}' | sed -e 's|^"| |' -e 's|",$||' -e 's|,$||'
|
||||
}
|
||||
|
||||
GetAssetNamesFromFile() {
|
||||
local file="$1"
|
||||
local prompt_optional="$2"
|
||||
Promptln "$prompt_optional"
|
||||
grep '^ "name":' "$file" | GetValueFromPipeAndIndent
|
||||
}
|
||||
GetReleaseIdFromFile() {
|
||||
local file="$1"
|
||||
local prompt_optional="$2"
|
||||
Prompt "$prompt_optional"
|
||||
grep '^ "id":' "$1" | GetValueFromPipe
|
||||
}
|
||||
GetTagNamesFromFile() {
|
||||
local file="$1"
|
||||
local prompt_optional="$2"
|
||||
Promptln "$prompt_optional"
|
||||
grep '^ "tag_name":' "$1" | GetValueFromPipeAndIndent
|
||||
}
|
||||
GetAssetIdFromFile() {
|
||||
local file="$1"
|
||||
local assetname="$2"
|
||||
local prompt_optional="$3" # optional
|
||||
Prompt "$prompt_optional"
|
||||
grep -B2 "\"$assetname\"," "$file" | grep '"id":' | GetValueFromPipe
|
||||
}
|
||||
|
||||
|
||||
declare -A GITHUB_INFO
|
||||
|
||||
PrepareGithubInfo() { # put some useful values to GITHUB_INFO
|
||||
local reponame="$1"
|
||||
local tag="$2"
|
||||
|
||||
if [ -n "$reponame" ] ; then
|
||||
GITHUB_INFO["reponame"]="$reponame"
|
||||
else
|
||||
test -r .git/config || { echo2 "Need repo name but cannot find .git/config under the working folder $PWD." ; return 1 ; }
|
||||
GITHUB_INFO["reponame"]="$(basename $(grep "https://github.com" .git/config 2>/dev/null | awk '{print $3}') .git)"
|
||||
test -n "${GITHUB_INFO["reponame"]}" || { echo2 "Repo name is not available." ; return 1 ; }
|
||||
fi
|
||||
if [ -n "$tag" ] ; then
|
||||
GITHUB_INFO["tag"]="$tag"
|
||||
else
|
||||
GITHUB_INFO["tag"]="LATEST"
|
||||
fi
|
||||
|
||||
test -r ~/.config/hub || { echo2 "cannot find ~/.config/hub, is 'hub' installed and initialized?" ; return 1 ; }
|
||||
|
||||
#GITHUB_INFO["owner"]="$(grep "user:" ~/.config/hub | awk '{print $NF}')"
|
||||
GITHUB_INFO["owner"]="$(grep "https://github.com" .git/config | awk '{print $NF}' | sed -e 's|^https://github.com/||' -e 's|/.*$||')"
|
||||
test -n "${GITHUB_INFO["owner"]}" || { echo2 "Owner info is not available." ; return 1 ; }
|
||||
|
||||
GITHUB_INFO["oauth_token"]="$(grep "oauth_token:" ~/.config/hub | awk '{print $NF}')"
|
||||
test -n "${GITHUB_INFO["oauth_token"]}" || { echo2 "Github API token is not available." ; return 1 ; }
|
||||
}
|
||||
|
||||
GetReleaseInfoToFile()
|
||||
{
|
||||
local asset_info_file="$1"
|
||||
local tag="$2"
|
||||
local reponame="$3"
|
||||
local owner
|
||||
local oauth_token
|
||||
|
||||
PrepareGithubInfo "$reponame" "$tag" || DIE "PrepareGithubInfo() failed." "$asset_info_file"
|
||||
|
||||
tag="${GITHUB_INFO["tag"]}"
|
||||
reponame="${GITHUB_INFO["reponame"]}"
|
||||
owner="${GITHUB_INFO["owner"]}"
|
||||
oauth_token="${GITHUB_INFO["oauth_token"]}"
|
||||
|
||||
local GH_REPO="https://api.github.com/repos/$owner/$reponame"
|
||||
local GH_TAG="$GH_REPO/releases/tags/$tag"
|
||||
local AUTH="Authorization: token $oauth_token"
|
||||
|
||||
test "$tag" = "LATEST" && GH_TAG="$GH_REPO/releases/latest"
|
||||
|
||||
if [ "$(stat -c %s "$asset_info_file")" = "0" ] ; then
|
||||
#Info "Fetching github info..."
|
||||
|
||||
# Validate token.
|
||||
curl -o /dev/null -sH "$AUTH" $GH_REPO || DIE "Invalid repo, token or network issue!" "$asset_info_file"
|
||||
|
||||
# Read asset info into the file.
|
||||
curl -sH "$AUTH" $GH_TAG > $asset_info_file || DIE "failed to fetch assets info from '$GH_TAG'."
|
||||
fi
|
||||
}
|
||||
|
||||
DeleteAsset()
|
||||
{
|
||||
local asset_info_file="$1"
|
||||
local asset_name="$2"
|
||||
local quietly="$3" # if yes, then no questions are asked about deletion
|
||||
|
||||
local asset_id="$(GetAssetIdFromFile "$asset_info_file" "$asset_name")"
|
||||
#local repo="${GITHUB_INFO["reponame"]}"
|
||||
#local owner="${GITHUB_INFO["owner"]}"
|
||||
#local oauth_token="${GITHUB_INFO["oauth_token"]}"
|
||||
local answer
|
||||
|
||||
if [ "$asset_id" = "" ]; then
|
||||
WARN "asset id not found for '$asset_name'."
|
||||
return 1
|
||||
fi
|
||||
|
||||
case "$quietly" in
|
||||
no)
|
||||
# Final chance to prevent deleting ...
|
||||
read -p "Delete asset '$asset_name' (Y/n)? " answer
|
||||
case "$answer" in
|
||||
y|Y|"") ;;
|
||||
*) return ;;
|
||||
esac
|
||||
;;
|
||||
yes)
|
||||
echo "deleting asset $asset_name ..."
|
||||
;;
|
||||
esac
|
||||
|
||||
hub api -t -X "DELETE" "https://api.github.com/repos/{owner}/{repo}/releases/assets/$asset_id"
|
||||
|
||||
# local GITHUB_OAUTH_BASIC="" # ??
|
||||
# curl $GITHUB_OAUTH_BASIC -X "DELETE" -H "Authorization: token $oauth_token" \
|
||||
# "https://api.github.com/repos/$owner/$repo/releases/assets/$asset_id"
|
||||
}
|
||||
|
||||
Main() # parameters: [--quietly] TAG assetname...
|
||||
{
|
||||
local xx
|
||||
local quietly=no
|
||||
local shifts=0
|
||||
|
||||
for xx in "$@" ; do
|
||||
case "$xx" in
|
||||
--quietly) quietly=yes ; ((shifts++)) ;;
|
||||
esac
|
||||
done
|
||||
shift $shifts
|
||||
local tag="$1"
|
||||
shift # other parameters are asset names, i.e. file names without any path
|
||||
local github_asset
|
||||
local asset
|
||||
local asset_info_file
|
||||
local matched_assets=()
|
||||
|
||||
# Note: asset names can also be shortened, e.g. "yay-" or "downgrad".
|
||||
# Then all assets starting with that name are deleted, so be careful.
|
||||
|
||||
test -n "$tag" || DIE "TAG is missing."
|
||||
test -n "$1" || DIE "Assets are missing."
|
||||
|
||||
asset_info_file=$(mktemp)
|
||||
|
||||
GetReleaseInfoToFile "$asset_info_file" "$tag" # repo
|
||||
|
||||
# Check that the given tag exists.
|
||||
for xx in $(GetTagNamesFromFile "$asset_info_file") ; do
|
||||
test "$tag" = "$xx" && break
|
||||
done
|
||||
test "$tag" = "$xx" || DIE "TAG '$tag' does not exist (find with 'hub release')." "$asset_info_file"
|
||||
|
||||
# Match given assets to github assets.
|
||||
local github_assets="$(GetAssetNamesFromFile "$asset_info_file")"
|
||||
local delete_all=no
|
||||
|
||||
case "$delete_all" in
|
||||
yes)
|
||||
for github_asset in $github_assets ; do
|
||||
matched_assets+=("$github_asset")
|
||||
done
|
||||
;;
|
||||
no)
|
||||
for asset in "$@" ; do
|
||||
for github_asset in $github_assets ; do
|
||||
case "$github_asset" in
|
||||
${asset}*)
|
||||
for xx in "${matched_assets[@]}" ; do
|
||||
test "$xx" = "$github_asset" && break
|
||||
done
|
||||
if [ "$xx" != "$github_asset" ] ; then
|
||||
matched_assets+=("$github_asset")
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
done
|
||||
test -n "$matched_assets" || DIE "Asset '$asset' does not match to any asset at github." "$asset_info_file"
|
||||
done
|
||||
;;
|
||||
esac
|
||||
|
||||
# Now delete given assets from github.
|
||||
for asset in "${matched_assets[@]}" ; do
|
||||
DeleteAsset "$asset_info_file" "$asset" "$quietly" || DIE "Failed to delete asset '$asset'." "$asset_info_file"
|
||||
#sleep 0.5
|
||||
done
|
||||
|
||||
rm -f "$asset_info_file" # file no more needed
|
||||
}
|
||||
|
||||
Main "$@" # tag asset(s)
|
||||
Executable
+35
@@ -0,0 +1,35 @@
|
||||
#!/bin/bash
|
||||
|
||||
HubRelease() {
|
||||
if which logstuff >& /dev/null ; then
|
||||
if ! logstuff state ; then
|
||||
logstuff on
|
||||
fi
|
||||
fi
|
||||
hub release "$@"
|
||||
}
|
||||
|
||||
Usage() {
|
||||
local progname=$(basename "$0")
|
||||
cat <<EOF
|
||||
Usage: $progname tag [file-pattern]
|
||||
EOF
|
||||
[ -n "$1" ] && exit "$1"
|
||||
}
|
||||
|
||||
Main()
|
||||
{
|
||||
local tag="$1"
|
||||
local pattern="$2"
|
||||
|
||||
if [ -z "$tag" ] ; then
|
||||
Usage 0
|
||||
fi
|
||||
if [ -n "$pattern" ] ; then
|
||||
pattern="-i $pattern"
|
||||
fi
|
||||
|
||||
HubRelease download $tag $pattern
|
||||
}
|
||||
|
||||
Main "$@"
|
||||
@@ -0,0 +1,51 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Config file for the EndeavourOS 'mirrorcheck' program.
|
||||
|
||||
# Array of mirror names. Names are used as indexes to MIRROR_URLS.
|
||||
#
|
||||
local MIRROR_NAMES=( # server name substrings: keep updated with the endeavouros mirror list!
|
||||
Alpix # Germany
|
||||
De.Freedif # Germany
|
||||
Moson # Germany
|
||||
Umu # Sweden
|
||||
Gate # Canada
|
||||
Jlu # China
|
||||
Tsinghua # China
|
||||
Jingk # Singapore
|
||||
Mirror.Freedif # Singapore
|
||||
Remi # France
|
||||
Albony # India
|
||||
Vishnetwork # India
|
||||
#Hacktegic # Moldova
|
||||
#Fastmirror # Ukraine
|
||||
Gigenet # United States
|
||||
Funami # South Korea
|
||||
Tw # Taiwan
|
||||
Pp # Ukraine
|
||||
)
|
||||
|
||||
# Internet URL to the mirror's folder where EndeavourOS repo packages are.
|
||||
# Note: some mirrors require a trailing slash '/' character.
|
||||
#
|
||||
declare -A MIRROR_URLS
|
||||
|
||||
___set_mirror_urls() {
|
||||
local list=/etc/pacman.d/endeavouros-mirrorlist
|
||||
local name xx
|
||||
|
||||
for name in "${MIRROR_NAMES[@]}" ; do
|
||||
xx="$(grep "^Server = " $list | grep -iw "$name" | head -n1 | awk '{print $3}')/" # note: / at end !!
|
||||
if [ "$xx" = "/" ] ; then
|
||||
xx="$(grep "^#Server = " $list | grep -iw "$name" | head -n1 | awk '{print $3}')/" # note: / at end !!
|
||||
fi
|
||||
if [ "$xx" != "/" ] ; then
|
||||
MIRROR_URLS[$name]="$xx"
|
||||
else
|
||||
echo "==> eos-mirrorcheck.conf: error: mirror name '$name' refers to no URL!" >&2
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
___set_mirror_urls
|
||||
unset -f ___set_mirror_urls
|
||||
Executable
+74
@@ -0,0 +1,74 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo2() { echo "$@" >&2 ; }
|
||||
DIE() { echo2 "Error: $1" ; exit 1 ; }
|
||||
WARN() { echo2 "Warning: $1" ; }
|
||||
Pushd() { pushd "$@" >/dev/null || DIE "'pushd $*' failed." ; }
|
||||
Popd() { popd "$@" >/dev/null || DIE "'popd $*' failed." ; }
|
||||
|
||||
Main() {
|
||||
echo2 "Creating a 'release assets build environment' for the repo in the current (git) folder."
|
||||
test -d .git || DIE "this folder ($PWD) does not have a .git subfolder."
|
||||
|
||||
local gitdir="$PWD"
|
||||
local builddirbase="$gitdir/../_BUILD_/$(basename "$gitdir")"
|
||||
local builddir
|
||||
|
||||
local confurls="https://github.com/endeavouros-team/PKGBUILDS/raw/master/eos-pkgbuild-setup" # configs are here
|
||||
local conf
|
||||
|
||||
local reponame=$(grep "url =" .git/config | awk '{print $NF}')
|
||||
reponame="${reponame##*/}" # remove head
|
||||
reponame="${reponame%.*}" # remove tail
|
||||
|
||||
local tags="$(hub release)"
|
||||
local tag
|
||||
local suffix
|
||||
local dirscreated=()
|
||||
local sigfile sigend=sig
|
||||
|
||||
for tag in $tags ; do
|
||||
#if [ "$reponame|$tag" = "mirrors|mirror2" ] ; then
|
||||
# continue # create only one build env for mirror1 and mirror2 (assets are the same)
|
||||
#fi
|
||||
suffix="$reponame.$tag"
|
||||
builddir="$builddirbase.$tag" # uses local dirname, may not be reponame...
|
||||
conf="${confurls}/assets.conf.$suffix"
|
||||
|
||||
mkdir -p "$builddir"
|
||||
|
||||
Pushd "$builddir"
|
||||
|
||||
wget -q --timeout=10 "$conf" || {
|
||||
Popd
|
||||
WARN "file '$conf' not found."
|
||||
rmdir "$builddir"
|
||||
continue
|
||||
}
|
||||
wget -q --timeout=10 "$conf".$sigend || {
|
||||
Popd
|
||||
WARN "file '$conf.$sigend' not found."
|
||||
rmdir "$builddir"
|
||||
continue
|
||||
}
|
||||
sigfile="$(basename "$conf.$sigend")"
|
||||
test -r "$sigfile" && {
|
||||
gpg --verify "$sigfile" || DIE "$sigfile: signature check failed!"
|
||||
rm -f "$sigfile"
|
||||
mv "assets.conf.$suffix" "assets.conf"
|
||||
}
|
||||
Popd
|
||||
|
||||
dirscreated+=("$builddir")
|
||||
done
|
||||
|
||||
echo2 "The following build folders were created:"
|
||||
for builddir in "${dirscreated[@]}" ; do
|
||||
echo2 " $builddir"
|
||||
done
|
||||
echo2 "Assets can be built in them with these commands:"
|
||||
echo2 " cd <build-folder>"
|
||||
echo2 " assets.make"
|
||||
}
|
||||
|
||||
Main "$@"
|
||||
@@ -0,0 +1 @@
|
||||
EOS_PKGBUILD_GITHUB_TIMEOUT=5
|
||||
@@ -0,0 +1,3 @@
|
||||
|
||||
EOS_ROOT="" # this sets the base folder for everything!
|
||||
source /etc/eos-pkgbuild-setup-general.conf || exit 1
|
||||
Executable
+208
@@ -0,0 +1,208 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Check that the github repo has the same package and db files as the given local folder.
|
||||
#
|
||||
|
||||
echo2() { echo "$@" >&2 ; }
|
||||
|
||||
DIE() {
|
||||
echo2 "Error: $1"
|
||||
exit 1
|
||||
}
|
||||
|
||||
NameCheck() {
|
||||
local xx yy
|
||||
for xx in "$@" ; do
|
||||
for yy in $remotefilelist ; do
|
||||
test "$xx" = "$yy" && break
|
||||
done
|
||||
if [ "$xx" = "$yy" ] ; then
|
||||
echo2 " OK: $xx"
|
||||
else
|
||||
echo2 "file $xx missing from $MIRROR_NAME !"
|
||||
problemfiles+="$xx "
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
ContentsCheck() {
|
||||
local xx remfiles=""
|
||||
local failcode=0
|
||||
|
||||
sleep 1 # github has problems if fetching fast and repeatedly ???
|
||||
|
||||
for xx in "$@" ; do
|
||||
remfiles+="$MIRROR_URL/$xx "
|
||||
done
|
||||
|
||||
pushd $tmpdir >/dev/null
|
||||
if [ 0 -eq 1 ] ; then
|
||||
wget -q --timeout=20 --show-progress $remfiles || failcode=$?
|
||||
else
|
||||
curl --location --remote-time --max-time 20 --remote-name-all --progress-bar --fail $remfiles || failcode=$?
|
||||
fi
|
||||
popd >/dev/null
|
||||
|
||||
if [ $failcode -ne 0 ] ; then
|
||||
echo2 "Error: fetching github files failed (code $failcode)."
|
||||
problemfiles+="$remfiles "
|
||||
return $failcode
|
||||
fi
|
||||
|
||||
for xx in "$@" ; do
|
||||
cmp $xx $tmpdir/$xx >/dev/null
|
||||
if [ $? -eq 0 ] ; then
|
||||
echo2 " OK: $xx"
|
||||
else
|
||||
echo2 "file $xx is different !"
|
||||
problemfiles+="$xx "
|
||||
fi
|
||||
rm -f $tmpdir/$xx
|
||||
done
|
||||
}
|
||||
|
||||
Usage() {
|
||||
local progname="$(basename $0)"
|
||||
cat <<EOF >&2
|
||||
$progname: Check the validity of $SIGNER packages in the $MIRROR_NAME mirror.
|
||||
|
||||
Usage: $progname [parameters]
|
||||
parameters:
|
||||
--slow Check contents of each file.
|
||||
--fast Check just the name of all package files.
|
||||
--optimized Check contents of some files, and names of other files.
|
||||
--no-filelist Don't generate list of latest files into the repo.
|
||||
folder-name Name of the local folder that contains package files.
|
||||
If not given, current folder is used.
|
||||
EOF
|
||||
}
|
||||
|
||||
Main()
|
||||
{
|
||||
if [ 1 -eq 1 ] ; then
|
||||
if [ ! -r assets.conf ] ; then
|
||||
DIE "no assets.conf found!"
|
||||
fi
|
||||
source assets.conf
|
||||
local MIRROR_NAME=Github
|
||||
local MIRROR_URL=""
|
||||
local findpart=""
|
||||
if [ -z "$REPO_COMPRESSOR" ] ; then
|
||||
local REPO_COMPRESSOR=xz
|
||||
fi
|
||||
case "$SIGNER" in
|
||||
EndeavourOS)
|
||||
case "$REPONAME" in
|
||||
endeavouros | endeavouros_calamares)
|
||||
MIRROR_URL=https://github.com/endeavouros-team/mirrors/releases/tag/"${RELEASE_TAGS[0]}"
|
||||
findpart=/endeavouros-team/mirrors/releases/download/"${RELEASE_TAGS[0]}"/
|
||||
;;
|
||||
endeavouros-testing-dev)
|
||||
MIRROR_URL=https://github.com/endeavouros-team/repo-testing/releases/tag/"${RELEASE_TAGS[0]}"
|
||||
findpart=/endeavouros-team/repo-testing/releases/download/"${RELEASE_TAGS[0]}"/
|
||||
;;
|
||||
*)
|
||||
DIE "sorry, unsupported repo name '$REPONAME'."
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
*)
|
||||
MIRROR_URL=https://github.com/$REPO_OWNER/$REPONAME/releases/tag/"${RELEASE_TAGS[0]}"/
|
||||
findpart=/$REPO_OWNER/$REPONAME/releases/download/"${RELEASE_TAGS[0]}"/
|
||||
;;
|
||||
esac
|
||||
else
|
||||
local conf=/etc/eos-mirrorcheck.conf
|
||||
test -r $conf || DIE "configuration file $conf is required but not found."
|
||||
source $conf
|
||||
test -n "$MIRROR_URL" || DIE "variable MIRROR_URL has no value, check file $conf."
|
||||
test -n "$MIRROR_NAME" || DIE "variable MIRROR_NAME has no value, check file $conf."
|
||||
fi
|
||||
|
||||
local folder=""
|
||||
local remotefilelist
|
||||
local packages repofiles
|
||||
local problemfiles=""
|
||||
local arg
|
||||
|
||||
# options
|
||||
local mode=fast # show, optimized, fast
|
||||
local has_filelist=no
|
||||
|
||||
for arg in "$@" ; do
|
||||
case "$arg" in
|
||||
--2) : # not used anymore
|
||||
# check mirror2 instead of mirror1
|
||||
# MIRROR_URL=https://github.com/endeavouros-team/mirrors/releases/tag/"${RELEASE_TAGS[1]}"
|
||||
# findpart=/endeavouros-team/mirrors/releases/download/"${RELEASE_TAGS[1]}"/
|
||||
;;
|
||||
--slow) mode=slow ;;
|
||||
--fast) mode=fast ;;
|
||||
--optimized) mode=optimized ;;
|
||||
--filelist) has_filelist=yes ;; # use repofiles.txt
|
||||
-*) Usage ; return ;;
|
||||
*) folder="$arg" ;;
|
||||
esac
|
||||
done
|
||||
|
||||
test -n "$folder" || folder=.
|
||||
test -d "$folder" || DIE "folder $folder does not exist!"
|
||||
# test -r "$folder/endeavouros.db" || {
|
||||
# echo2 "$(basename $0): nothing to see here."
|
||||
# return
|
||||
# }
|
||||
|
||||
echo2 "Fetching $MIRROR_NAME package info..."
|
||||
remotefilelist="$(curl -s "$MIRROR_URL" | grep $findpart | sed -e 's|^.*'$findpart'||' -e 's|" rel=.*$||')"
|
||||
test -n "$remotefilelist" || DIE "cannot fetch package info from '$MIRROR_URL'."
|
||||
MIRROR_URL="$(echo "$MIRROR_URL" | sed 's|/tag/|/download/|')"
|
||||
|
||||
pushd "$folder" >/dev/null
|
||||
|
||||
packages="$(ls -1 *.pkg.tar.*)"
|
||||
|
||||
local SigLevel="$(grep -A3 "^\[$REPONAME\]$" /etc/pacman.conf | grep "^SigLevel = " | awk '{print $3}')"
|
||||
case "$SigLevel" in
|
||||
Required) repofiles="$(echo $REPONAME.{db,files}{,.tar.$REPO_COMPRESSOR}{,.sig})" ;;
|
||||
*) repofiles="$(echo $REPONAME.{db,files}{,.tar.$REPO_COMPRESSOR})" ;;
|
||||
esac
|
||||
|
||||
# Check files. 'NameCheck' is very fast but unreliable. 'ContentsCheck' is quite slow but reliable.
|
||||
local tmpdir=$(mktemp -d)
|
||||
ContentsCheck $repofiles # This should make sure all is OK ! (?)
|
||||
if [ "$has_filelist" = "yes" ] ; then
|
||||
ContentsCheck repofiles.txt
|
||||
fi
|
||||
|
||||
case "$mode" in
|
||||
fast)
|
||||
NameCheck $packages
|
||||
;;
|
||||
slow)
|
||||
ContentsCheck $packages
|
||||
;;
|
||||
optimized)
|
||||
for arg in $packages ; do
|
||||
case "$arg" in
|
||||
# icon theme packages are very big
|
||||
paper-icon-theme-*.pkg.tar.xz | paper-icon-theme-*.pkg.tar.zst | \
|
||||
arc-x-icons-theme-*.pkg.tar.xz | arc-x-icons-theme-*.pkg.tar.zst)
|
||||
NameCheck "$arg" ;;
|
||||
*)
|
||||
ContentsCheck "$arg" ;;
|
||||
esac
|
||||
done
|
||||
;;
|
||||
esac
|
||||
rm -rf $tmpdir
|
||||
|
||||
if [ -z "$problemfiles" ] ; then
|
||||
echo2 "No issues."
|
||||
else
|
||||
echo2 -n "Problematic files: "
|
||||
echo $problemfiles
|
||||
fi
|
||||
popd >/dev/null
|
||||
}
|
||||
|
||||
Main "$@"
|
||||
Executable
+70
@@ -0,0 +1,70 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Setup to ignore certain files from git.
|
||||
#
|
||||
# Preparations:
|
||||
# - git clone https://github.com/endeavouros-team/PKGBUILDS.git
|
||||
# - cd PKGBUILDS/eos-pkgbuild-setup
|
||||
#
|
||||
# We want to add/update files:
|
||||
# - PKGBUILDS/.gitignore
|
||||
# - ~/.config/git/ignore
|
||||
|
||||
DIE() {
|
||||
echo "Error: $1" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
AddGitIgnores() {
|
||||
local file="$1"
|
||||
local ignoredef count=0
|
||||
shift
|
||||
|
||||
for ignoredef in "$@" ; do
|
||||
if [ -z "$(grep "^$ignoredef$" "$file")" ] ; then
|
||||
echo "$ignoredef" >> "$file"
|
||||
((count++))
|
||||
fi
|
||||
done
|
||||
[ $count -gt 0 ] && echo "Updated $file"
|
||||
}
|
||||
|
||||
Main() {
|
||||
local workdir=eos-pkgbuild-setup
|
||||
local file
|
||||
local xx count
|
||||
local ignores=()
|
||||
|
||||
# Check the working folder.
|
||||
|
||||
case "$PWD" in
|
||||
*/PKGBUILDS/$workdir) workdir="$PWD" ;;
|
||||
*) DIE "Run this in folder <path>/PKGBUILDS/$workdir" ;;
|
||||
esac
|
||||
|
||||
# Set up PKGBUILDS/.gitignore.
|
||||
|
||||
local pkgdef="*$(grep '^PKGEXT=' /etc/makepkg.conf 2>/dev/null | cut -d '=' -f2 | tr -d "'")"
|
||||
ignores=(
|
||||
"$pkgdef" # package files to ignore, like "*.pkg.tar.zst"
|
||||
"*~" # emacs backup files
|
||||
pkg # makepkg leftover
|
||||
src # makepkg leftover
|
||||
REGTEST # ad hoc stuff (optional)
|
||||
)
|
||||
AddGitIgnores "$workdir/../.gitignore" "${ignores[@]}"
|
||||
|
||||
# Set up "global" git ignores.
|
||||
|
||||
ignores=(
|
||||
".gitignore" # version control not needed for these files
|
||||
".no-cd" # used by package cd-path (optional)
|
||||
".GitUpdate" # used by package GitUpdate
|
||||
EXPERIMENTAL # ad hoc stuff (optional)
|
||||
TODO # ditto
|
||||
RCS # ditto
|
||||
)
|
||||
AddGitIgnores "$HOME/.config/git/ignore" "${ignores[@]}"
|
||||
}
|
||||
|
||||
Main "$@"
|
||||
Executable
+262
@@ -0,0 +1,262 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Check that a mirror repo has the same package and db files as the given local folder.
|
||||
#
|
||||
|
||||
echo2() { echo "$@" >&2 ; }
|
||||
echo2i() { echoi "$@" >&2 ; }
|
||||
echoi() {
|
||||
local level=""
|
||||
local xx
|
||||
local optcount=0
|
||||
for xx in "$@" ; do
|
||||
case "$xx" in
|
||||
-l=*) level=${xx:3} ; ((optcount++)) ;;
|
||||
-l*) level=${xx:2} ; ((optcount++)) ;;
|
||||
-*) DIE "unsupported option $xx" ;; # non-options cannot start with '-'
|
||||
*) break ;; # all options must be before other params
|
||||
esac
|
||||
done
|
||||
if [ -n "$level" ] ; then
|
||||
shift $optcount
|
||||
else
|
||||
level=1
|
||||
fi
|
||||
|
||||
printf "%*s" $((level*4)) ""
|
||||
echo2 "$@"
|
||||
}
|
||||
|
||||
DIE() {
|
||||
echo2 "Error: $1"
|
||||
Usage
|
||||
exit 1
|
||||
}
|
||||
|
||||
NameCheck() {
|
||||
local xx yy
|
||||
for xx in "$@" ; do
|
||||
for yy in $remotefilelist ; do
|
||||
yy="${yy/\%2B/+}" # convert character code '%2B' to '+'
|
||||
test "$xx" = "$yy" && break
|
||||
done
|
||||
if [ "$xx" != "$yy" ] ; then
|
||||
echo2i "FAIL: $xx is missing from $reponame !"
|
||||
problemfiles+="$xx "
|
||||
else
|
||||
case "$mode" in
|
||||
fastall) ;;
|
||||
*) echo2 " OK: $xx" ;;
|
||||
esac
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
ContentsCheck() {
|
||||
local xx
|
||||
local url=""
|
||||
local repo_dir=""
|
||||
local orig_url="${mirror_url%/}"
|
||||
|
||||
for xx in "$@" ; do
|
||||
case "$xx" in
|
||||
state)
|
||||
url="${orig_url}/../.."
|
||||
repo_dir="../../repo"
|
||||
;;
|
||||
*)
|
||||
url="${orig_url}"
|
||||
repo_dir="."
|
||||
;;
|
||||
esac
|
||||
|
||||
if ! curl -Lfsm 10 -o "$tmpdir/$xx" "$url/$xx" ; then
|
||||
echo2i "FAIL: $xx fetching failed."
|
||||
problemfiles+="$xx "
|
||||
continue
|
||||
fi
|
||||
if ! cmp "$repo_dir/$xx" "$tmpdir/$xx" >/dev/null ; then
|
||||
echo2i "FAIL: $xx is different !"
|
||||
problemfiles+="$xx "
|
||||
continue
|
||||
fi
|
||||
rm -f "$tmpdir/$xx"
|
||||
echo2 " OK: $xx"
|
||||
done
|
||||
}
|
||||
|
||||
OneMirror() {
|
||||
local remotefilelist
|
||||
local packages repofiles
|
||||
local problemfiles=""
|
||||
local mirror_url
|
||||
local repo=endeavouros
|
||||
|
||||
mirror_url="${MIRROR_URLS[$reponame]}"
|
||||
test -n "$mirror_url" || DIE "MIRROR_URLS[$reponame] is empty! Check file $conf."
|
||||
|
||||
test -n "$folder" || folder=.
|
||||
test -d "$folder" || DIE "folder $folder does not exist!"
|
||||
test -r "$folder/endeavouros.db" || {
|
||||
echo2 "$(basename $0): nothing to see here."
|
||||
return
|
||||
}
|
||||
|
||||
mirror_url="$(echo "$mirror_url" | sed "s|\$arch|$arch|")"
|
||||
mirror_url="$(echo "$mirror_url" | sed "s|\$repo|$repo|")"
|
||||
|
||||
echo2 "$reponame:"
|
||||
remotefilelist="$(curl -s "$mirror_url" | grep -Pw 'tar|db|files' | sed 's|.*<a href="\([^"]*\)".*|\1|')"
|
||||
test -n "$remotefilelist" || DIE "cannot fetch package info from $mirror_url."
|
||||
|
||||
pushd "$folder" >/dev/null
|
||||
|
||||
packages="$(ls -1 *.pkg.tar.*)"
|
||||
repofiles="$(echo endeavouros.{db,files}{,.tar.xz})"
|
||||
|
||||
# Check files. 'NameCheck' is very fast but unreliable. 'ContentsCheck' is quite slow but reliable.
|
||||
local tmpdir=$(mktemp -d)
|
||||
ContentsCheck $repofiles # This should make sure all is OK ! (?)
|
||||
ContentsCheck state
|
||||
if [ "$has_filelist" = "yes" ] ; then
|
||||
ContentsCheck repofiles.txt
|
||||
fi
|
||||
|
||||
case "$mode" in
|
||||
fast | fastall)
|
||||
NameCheck $packages
|
||||
;;
|
||||
slow)
|
||||
ContentsCheck $packages
|
||||
;;
|
||||
optimized)
|
||||
for arg in $packages ; do
|
||||
case "$arg" in
|
||||
# icon theme packages are very big
|
||||
paper-icon-theme-*.pkg.tar.xz | paper-icon-theme-*.pkg.tar.zst | \
|
||||
arc-x-icons-theme-*.pkg.tar.xz | arc-x-icons-theme-*.pkg.tar.zst)
|
||||
NameCheck "$arg" ;;
|
||||
*)
|
||||
ContentsCheck "$arg" ;;
|
||||
esac
|
||||
done
|
||||
;;
|
||||
esac
|
||||
rm -rf $tmpdir
|
||||
|
||||
if [ -z "$problemfiles" ] ; then
|
||||
echo2i "==> No issues."
|
||||
else
|
||||
echo2i "==> Not yet ready."
|
||||
|
||||
#echo2i "==> Problematic files: "
|
||||
#for arg in $problemfiles ; do
|
||||
# echoi -l3 "$arg"
|
||||
#done
|
||||
fi
|
||||
popd >/dev/null
|
||||
}
|
||||
|
||||
Usage() {
|
||||
local progname="$(basename $0)"
|
||||
cat <<EOF >&2
|
||||
|
||||
$progname: Check the validity of EndeavourOS packages in mirrors.
|
||||
|
||||
Usage: $progname [parameters]
|
||||
parameters:
|
||||
--slow Check contents of each file.
|
||||
--fast Check just the name of all package files (default).
|
||||
--optimized Check contents of some files, and names of other files.
|
||||
--reponame=X Use given name as the mirror name (default: all known mirrors).
|
||||
--no-filelist Don't generate list of latest files into the repo.
|
||||
--show-params Show all available parameters as a list (for completion support).
|
||||
<folder-name> Name of the local folder that contains package files.
|
||||
If not given, current folder is used.
|
||||
|
||||
EOF
|
||||
}
|
||||
|
||||
Main()
|
||||
{
|
||||
# use assets.conf
|
||||
# local assets_conf=./assets.conf
|
||||
# test -r $assets_conf || DIE "cannot find local file $assets_conf."
|
||||
|
||||
local has_filelist=no # "$(grep "^local USE_GENERATED_FILELIST=" $assets_conf | sed 's|^.*="\([yesno]*\)".*$|\1|')"
|
||||
local mode=fast # show, optimized, fast
|
||||
local folder=""
|
||||
local reponame
|
||||
local arg
|
||||
local conf=/etc/eos-mirrorcheck.conf
|
||||
local arch=""
|
||||
local supported_params=(
|
||||
"<folder-name>"
|
||||
--slow
|
||||
--fast
|
||||
--optimized
|
||||
--reponame=
|
||||
--no-filelist
|
||||
--show-params
|
||||
)
|
||||
|
||||
for arg in "$@" ; do
|
||||
case "$arg" in
|
||||
--reponame=*) reponame="${arg#*=}" ;;
|
||||
--slow) mode=slow ;;
|
||||
--fast) mode=fast ;;
|
||||
--optimized) mode=optimized ;;
|
||||
--no-filelist) has_filelist=no ;; # no repofiles.txt
|
||||
--show-params) echo "${supported_params[*]}" ; return ;;
|
||||
-*) DIE "unsupported parameter '$arg'" ;;
|
||||
*) folder="$arg" ;;
|
||||
esac
|
||||
done
|
||||
|
||||
[ -n "$folder" ] && cd "$folder"
|
||||
|
||||
if [ -r assets.conf ] && [ -d PKG_ARCHIVE ] ; then
|
||||
arch=x86_64 # we are in the original build folder
|
||||
else
|
||||
arch=$(basename "$PWD") # x86_64
|
||||
case "$arch" in
|
||||
x86_64 | aarch64 | armv7h) ;;
|
||||
*) DIE "must run this program at an architecture specific folder (e.g. repo/endeavouros/x86_64)." ;;
|
||||
esac
|
||||
case "$(grep "/endeavouros-team/" ../../.git/config)" in
|
||||
*https://github.com/endeavouros-team/repo | *https://github.com/endeavouros-team/repo.git) ;;
|
||||
*) DIE "this folder is not in endeavouros-team repo" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
test -r $conf || DIE "configuration file $conf is required but not found."
|
||||
|
||||
source $conf
|
||||
|
||||
test -n "${MIRROR_NAMES[0]}" || DIE "MIRROR_NAMES[0] is empty! Check file $conf."
|
||||
|
||||
case "$reponame" in
|
||||
"")
|
||||
reponame="${MIRROR_NAMES[0]}" # default: Alpix
|
||||
OneMirror
|
||||
;;
|
||||
all)
|
||||
#mode=fastall
|
||||
for reponame in "${MIRROR_NAMES[@]}" ; do
|
||||
OneMirror
|
||||
done
|
||||
;;
|
||||
*)
|
||||
local list=/etc/pacman.d/endeavouros-mirrorlist
|
||||
if [ -n "$(grep "^Server = " $list | grep -iw "$reponame")" ] ; then
|
||||
OneMirror
|
||||
else
|
||||
cat <<EOF
|
||||
Sorry, '$reponame' is unknown, or the URL is not active in file $list.
|
||||
EOF
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
Main "$@"
|
||||
@@ -0,0 +1,43 @@
|
||||
# bash completion for mirrorcheck -*- shell-script -*-
|
||||
|
||||
_my_complete() {
|
||||
COMPREPLY=( $(compgen -W "$1" -- "$cur") )
|
||||
[[ $COMPREPLY == *= ]] && compopt -o nospace
|
||||
}
|
||||
|
||||
_mirrorcheck_mirrornames() {
|
||||
source /etc/eos-mirrorcheck.conf
|
||||
echo "${MIRROR_NAMES[*]}"
|
||||
}
|
||||
|
||||
_mirrorcheck_()
|
||||
{
|
||||
local cur prev #words cword split
|
||||
_init_completion -s || return
|
||||
|
||||
# Handle options that need sub-options.
|
||||
# Each option "case" should return immediately.
|
||||
|
||||
case "$prev" in
|
||||
--reponame)
|
||||
_my_complete "$(_mirrorcheck_mirrornames)"
|
||||
return
|
||||
;;
|
||||
esac
|
||||
|
||||
# Handle top-level options.
|
||||
# Command 'mirrorcheck --show-params' shows all available parameters.
|
||||
|
||||
case "$cur" in
|
||||
-* | "")
|
||||
# Any option or no parameters.
|
||||
_my_complete "$(mirrorcheck --show-params)"
|
||||
;;
|
||||
*)
|
||||
# A non-option parameter given.
|
||||
# Folder required.
|
||||
_filedir -d
|
||||
;;
|
||||
esac
|
||||
} &&
|
||||
complete -F _mirrorcheck_ mirrorcheck
|
||||
Executable
+34
@@ -0,0 +1,34 @@
|
||||
#!/bin/bash
|
||||
|
||||
# pacman wrapper for helping in the phases of makepkg call.
|
||||
|
||||
echo2() { echo "$@" >&2 ; }
|
||||
|
||||
CheckToBeInstalled() {
|
||||
local name
|
||||
for name in "$@" ; do
|
||||
case "$name" in
|
||||
-*) ;;
|
||||
*)
|
||||
if ! /usr/bin/pacman -Q "$name" >& /dev/null ; then
|
||||
echo2 " -> install: $name"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
Main()
|
||||
{
|
||||
# echo2 "====> params: '$*'"
|
||||
|
||||
case "$1" in
|
||||
-Rns) echo2 "removing: $*" ;;
|
||||
-S|-U) echo2 "installing: $*" ;;
|
||||
-T) CheckToBeInstalled "$@" ;;
|
||||
-Qi) echo2 "removing make dependencies" ;;
|
||||
esac
|
||||
/usr/bin/pacman "$@"
|
||||
}
|
||||
|
||||
Main "$@"
|
||||
Executable
+30
@@ -0,0 +1,30 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Show names of all github release assets.
|
||||
#
|
||||
# Return value is 0 on success, 1 on failure.
|
||||
|
||||
DIE() {
|
||||
local progname="$(/usr/bin/basename "$0")"
|
||||
echo "$progname: error: $1" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
Main() {
|
||||
local tag="$1" # tag name for the release assets
|
||||
local retval=0
|
||||
local out=""
|
||||
|
||||
[ -n "$tag" ] || DIE "please give the release tag name!"
|
||||
|
||||
out=$(/usr/bin/hub release show -f %as%n "$tag")
|
||||
if [ -n "$out" ] ; then
|
||||
echo "$out" | /usr/bin/sed -e 's|^.*/||' -e 's|[ \t]*$||'
|
||||
else
|
||||
retval=1
|
||||
fi
|
||||
|
||||
return $retval
|
||||
}
|
||||
|
||||
Main "$@"
|
||||
Reference in New Issue
Block a user