Newer
Older
François Grisez
committed
#!/bin/bash
François Grisez
committed
prog=$(basename $0)
echo "syntax: $prog <dist>" 1>&2
François Grisez
committed
exit 2
print_usage $0
fi
if [ $# -ne 1 ]; then
print_usage $0
François Grisez
committed
fi
id=$(cat /dev/urandom | env LC_ALL=C tr -dc 'a-zA-Z0-9' | fold -w 10 | head -n 1) || exit $?
François Grisez
committed
tmpdir="$MAKE_REPO_TMP/tmp-$id"
rsync_dest="$DEPLOY_SERVER:$tmpdir/"
case "$dist" in
'centos')
make_repo_args="rpm $tmpdir $CENTOS_REPOSITORY"
;;
'rockylinux')
make_repo_args="rpm $tmpdir $ROCKYLINUX_REPOSITORY"
rsync_src='build/*.rpm'
François Grisez
committed
;;
'debian')
make_repo_args="deb $tmpdir $FREIGHT_PATH $RELEASE"
echo "make_repo_args=$make_repo_args"
François Grisez
committed
;;
*)
echo "invalid distribution type: '$dist'. Only 'centos', 'rockylinux' and 'debian' are valid" 1>&2
François Grisez
committed
exit 2
;;
esac
echo ">>> Pushing packages into '$rsync_dest'"
François Grisez
committed
echo ">>> Connecting on '$DEPLOY_SERVER'"
ssh $DEPLOY_SERVER "
echo '>>>> Making repository'
make_repo $make_repo_args || exit 1
echo \">>>> Removing '$tmpdir'\"
rm -r $tmpdir
"