#!/bin/sh . $(dirname $0)/conf.sh help="Options: setup add ..." repo_add_check() { test -d $repos/arch/ || { echo "Repository not found. Have you set it up?" >&2 exit 1 } which repo-add || { echo "Must install repo-add to manage pacman packages" >&2 exit 1 } } case $1 in setup) echo "Making arch package repository folders" for arch in x86_64 i686; do mkdir -p $repos/arch/$arch || exit 1 done echo keyid=$(get_gpg) echo "Making ReadMe file" echo "\ $setup_cmd_instruction ( echo '[$label]' echo 'Server = http://$uri_root/arch/\$arch' ) >> /etc/pacman.conf curl -L 'http://$uri_root/gpg.key' | pacman-key -a - pacman-key -f $keyid pacman-key --lsign-key $keyid pacman -Syu $install_cmd_instruction sudo pacman -S greenstone " > $repos/arch/ReadMe.txt ;; add) keyid=$(get_gpg) repo_add_check shift for pkg in $@; do # Default to all architectures unless an architecture is specified arch="x86_64 i686" echo $pkg | grep 'x86_64\.pkg' >/dev/null 2>/dev/null && { arch="x86_64" } echo $pkg | grep 'i686\.pkg' >/dev/null 2>/dev/null && { arch="i686" } name="$(basename $pkg)" for pkgarch in $arch; do dir="$repos/arch/$pkgarch" cp "$pkg" "$dir/" cd "$dir" echo "$name: $pkgarch" rm -f "${name}.sig" gpg --detach-sign --use-agent --default-key "$keyid" "$name" repo-add -s -k "$keyid" -v -d "${label}.db.tar.xz" "$name" cd - done done ;; -h|--help|help) echo "$help" ;; *) if test -z "$*"; then echo "$help" else repo_add_check repo-add $@ fi ;; esac