mirror of
https://github.com/emmett1/lfs-scripts.git
synced 2025-07-25 17:11:45 +00:00
52 lines
1.1 KiB
Bash
Executable File
52 lines
1.1 KiB
Bash
Executable File
#!/bin/bash
|
|
#
|
|
# - a simple wrapper script for pkgmk
|
|
# - will build, install, upgrade and other operation without 'cd' into each port directory
|
|
# - port will be search automatically follow REPO order, port found first will be selected
|
|
# - does not solve dependency
|
|
#
|
|
# usage:
|
|
# pkgin [port names] [pkgmk options]
|
|
#
|
|
|
|
trap "exit 1" SIGHUP SIGINT SIGQUIT SIGTERM
|
|
|
|
REPO="/usr/ports/core /usr/ports/extra /usr/ports/xorg /usr/ports/multilib"
|
|
|
|
while [ $1 ]; do
|
|
case $1 in
|
|
-*) PKGMK_CMD+=($1);;
|
|
*) PKG+=($1);;
|
|
esac
|
|
shift
|
|
done
|
|
|
|
if [[ "${PKG[@]}" = "" ]]; then
|
|
echo "Please provide port name to install."
|
|
exit 1
|
|
fi
|
|
|
|
for p in ${PKG[@]}; do
|
|
if pkginfo -i | awk '{print $1}' | grep -xq $p; then
|
|
echo "Package '$p' is installed."
|
|
continue
|
|
fi
|
|
PKGFOUND=no
|
|
for r in $REPO; do
|
|
if [ -f $r/$p/Pkgfile ]; then
|
|
PKGFOUND=yes
|
|
cd $r/$p &>/dev/null
|
|
pkgmk ${PKGMK_CMD[@]} || exit $?
|
|
[ -e bootstrap-post-install ] && sh bootstrap-post-install
|
|
[ -e post-install ] && sh post-install
|
|
cd - &>/dev/null
|
|
fi
|
|
done
|
|
if [ "$PKGFOUND" = "no" ]; then
|
|
echo "Port '$p' not found."
|
|
exit 1
|
|
fi
|
|
done
|
|
|
|
exit 0
|