You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

72 lines
2.4 KiB

# Get custom templates and display them on project README
update_readme() {
local_pkgs="$(git diff --name-only upstream/master master srcpkgs/ | awk -F "/" '{print $2}' | sort | uniq)"
for pkg in $local_pkgs; do
new_pkgs="$new_pkgs* [$pkg](srcpkgs/$pkg)
cat <<EOF >
This fork contains templates for the following list of packages:
If you'd like to build and install all the custom templates, run \`./deploy --install\`. Else, if you only want a specific package, manually run (make sure to have [\`xtools\`](https:/ installed):
./xbps-src binary-bootstrap
./xbps-src pkg pkgname
xi pkgname
# Check whether the package in our pkglist belongs to the main repo
# or if it's not found build it locally and install it
install() {
# Synchronize remote packages
doas xbps-install -Suvy
# Initialise the binary bootstrap for our local void-packages build
./xbps-src binary-bootstrap
if [ -f pkglist.txt ]; then
while IFS= read -r pkg || [ -n "$pkg" ]; do
# We need to strip the version number from the package name
pkgname="$(echo $pkg | rev | cut -d- -f 2- | rev)"
# Check if the package has already been installed
if xbps-query -l | grep -q "$pkgname"; then
echo "Package "$pkgname" already installed"
# Check if package is installed in the remote repository
elif [ $(xbps-query --regex -Rs "^$pkgname" | wc -l) -ne 0 ]; then
doas xbps-install -Sy "$pkgname"
# Check if the package is installed in the local repository
elif [ $(xpkg -L | grep -q "$pkgname") ]; then
# Check if package has already been built
if ! ls -a hostdir/binpkgs | grep -q "$pkgname"; then
./xbps-src pkg "$pkgname"
built_pkgs="$built_pkgs $pkgname"
built_pkgs="$built_pkgs $pkgname"
echo "Package "$pkgname" has already been locally installed"
# Check if the package exists in the local Void repository
elif [ "$(find srcpkgs -maxdepth 1 -name "$pkgname" -type d | wc -l)" -ne 0 ]; then
built_pkgs="$built_pkgs $pkgname"
echo "Package "$pkgname" does not exist neither in local nor remote Void repositories"
done < pkglist.txt
# Install locally built packages
[ "$built_pkgs" ] && doas xi -fy "$built_pkgs"
case "$1" in
--install) install;;
--update) update_readme;;