2023-04-22 14:06:00 +02:00
|
|
|
#!/bin/sh
|
|
|
|
VERSION="1.0.0"
|
|
|
|
DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
|
|
|
|
|
|
if [ "$1" = "init" ] || [ "$1" = "-i" ] || [ "$1" = "--init" ]; then
|
|
|
|
$DIR/scripts/repoinit.sh && echo "debrepo: repository folders have been successfully created"
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "$1" = "add" ] || [ "$1" = "-a" ] || [ "$1" = "--add" ]; then
|
2023-04-23 16:07:51 +02:00
|
|
|
# copy deb file to repo folder structure
|
|
|
|
cp "./$2" "./apt-repo/pool/main/"
|
|
|
|
# generate package and release file
|
2023-04-23 16:23:26 +02:00
|
|
|
$DIR/scripts/genPkgRel.sh $2 && echo "debrepo: package $2 was successfully added"
|
2023-04-22 14:06:00 +02:00
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "$1" = "del" ] || [ "$1" = "-d" ] || [ "$1" = "--del" ]; then
|
2023-04-23 16:07:51 +02:00
|
|
|
rm -i "./apt-repo/pool/main/$2" && echo "debrepo: package $2 was successfully removed"
|
2023-04-23 16:23:26 +02:00
|
|
|
# generate package and release file
|
|
|
|
$DIR/scripts/genPkgRel.sh $2 && echo "debrepo: repository was successfully updated"
|
2023-04-23 16:07:51 +02:00
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "$1" = "list" ] || [ "$1" = "-l" ] || [ "$1" = "--list" ]; then
|
|
|
|
echo "debrepo: list of packages"
|
|
|
|
ls -l "./apt-repo/pool/main/"
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "$1" = "serve" ] || [ "$1" = "-s" ] ||[ "$1" = "--serve" ]; then
|
|
|
|
python3 -m http.server
|
2023-04-22 14:06:00 +02:00
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "$1" = "-v" ] || [ "$1" = "--version" ]; then
|
|
|
|
echo "debrepo $VERSION"
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
|
|
|
#if [ "$1" = "help" ] || [ "$1" = "-h" ] || [ "$1" = "--help" ]; then
|
|
|
|
if [ 1 ]; then
|
|
|
|
HELPMESSAGE="
|
|
|
|
debrepo $VERSION
|
|
|
|
A Debian repository management tool.
|
|
|
|
|
|
|
|
USAGE:
|
|
|
|
debrepo [OPTIONS] [DEB]
|
|
|
|
|
|
|
|
OPTIONS:
|
|
|
|
init, -i, --init
|
|
|
|
create repository folder structure
|
|
|
|
add, -a, --add
|
|
|
|
add deb package to repository
|
|
|
|
del, -d, --del
|
|
|
|
delete deb package from repository
|
2023-04-23 16:07:51 +02:00
|
|
|
serve, -s, --serve
|
|
|
|
serve repository using python built in http module
|
2023-04-22 14:06:00 +02:00
|
|
|
help, -h, --help
|
|
|
|
print help message
|
|
|
|
-v, --version
|
|
|
|
print version of debrepo package
|
|
|
|
|
|
|
|
ARGS:
|
|
|
|
<DEB>...
|
|
|
|
*.deb package to add or delete from repository.
|
|
|
|
|
|
|
|
"
|
|
|
|
|
|
|
|
printf "%s\n" "$HELPMESSAGE"
|
|
|
|
fi
|
|
|
|
|