Files
ports/core/scratchpkg/portsync
emmett1 59439709d9 Revert "Revert "updated""
This reverts commit 21e9d7eec5.
2021-01-25 22:24:47 +08:00

64 lines
1.4 KiB
Bash
Executable File

#!/bin/sh
#
# script to fetch official Venom Linux ports
#
REPO_FILE=/etc/scratchpkg.repo
PORTSURL=https://github.com/venomlinux/ports/tree/master
if [ "$(id -u)" != 0 ]; then
echo "$0 need to run as root."
exit 1
fi
if [ ! -e "$REPO_FILE" ]; then
echo "Repo file '$REPO_FILE' not found."
exit 1
fi
for repodir in $(grep -Ev '^(#|$)' "$REPO_FILE" | awk '{print $1}'); do
case $repodir in
*/core|*/multilib|*/nonfree|*/testing) VREPO="$VREPO $repodir";;
esac
done
echo ":: Fetching ports..."
curl -# -LJ -o /tmp/venomports.tar.xz https://github.com/venomlinux/ports/tarball/master || {
echo "Failed fetching new ports. Aborted."
exit 1
}
tar -tf /tmp/venomports.tar.xz &>/dev/null || {
echo "Failed fetching ports. Aborted."
exit 1
}
venomportsdir=$(tar -tf /tmp/venomports.tar.xz | head -n1 | cut -d / -f1)
echo ":: Extracting new ports..."
tar -xf /tmp/venomports.tar.xz -C /tmp
echo ":: Updating ports..."
for i in $VREPO; do
repo=${i##*/}
if [ -d $i ] && [ ! -f $i/.REPO ]; then
echo "Directory '$i' is exist and not repo directory. Skipped."
continue
fi
if [ ! -d /tmp/$venomportsdir/$repo ] || [ ! -f /tmp/$venomportsdir/$repo/.REPO ]; then
echo "Missing repo '$repo'. Skipped"
continue
fi
rm -fr $i
mkdir -p $i
cp -ra /tmp/$venomportsdir/$repo/* $i
rm -f $i/*/update
touch $i/.REPO
echo " > $repo updated"
done
rm -fr /tmp/$venomportsdir /tmp/venomports.tar.xz
echo ":: Venom ports is updated."
exit 0