dotfiles/dot_local/bin/executable_xxdist

40 lines
783 B
Plaintext
Raw Normal View History

2023-09-15 15:46:04 -04:00
#!/bin/sh
branch_name="$(git branch --show-current)"
2024-05-01 09:31:41 -04:00
targets=""
install=false
distribute() {
rsync -P -r "${XBPS_DISTDIR}/hostdir/binpkgs/${branch_name}" "$1":
}
install() {
package_dir=$(basename "$branch_name")
ssh "$1" "xi -R $package_dir -Suy && rm -rf $package_dir"
}
if [ "$1" = "-i" ]; then
install=true
shift
fi
2023-09-15 15:46:04 -04:00
if [ $# = 0 ]; then
2024-05-01 09:31:41 -04:00
targets="daybreak epoch"
2023-09-15 15:46:04 -04:00
elif [ "$1" = "repo" ]; then
2024-05-01 09:31:41 -04:00
cd "${XBPS_DISTDIR}/hostdir/binpkgs/${branch_name}" || exit 1
2023-09-15 15:46:04 -04:00
for p in *.xbps; do
2024-05-01 09:31:41 -04:00
rsync -P "$p" daybreak:/srv/repo
2023-09-15 15:46:04 -04:00
ssh daybreak "xbps-rindex --add /srv/repo/$p;
xbps-rindex --privkey /srv/repo/private.pem --sign-pkg /srv/repo/*.xbps"
done
else
2024-05-01 09:31:41 -04:00
targets="$1"
2023-09-15 15:46:04 -04:00
fi
2024-05-01 09:31:41 -04:00
for t in $targets; do
distribute "$t"
if [ "$install" = true ]; then
install "$t"
fi
done