Skip to content

Commit f0ff3d0

Browse files
author
emmett1
committed
add function to use custom repo and alias file
1 parent 985f59f commit f0ff3d0

1 file changed

Lines changed: 32 additions & 28 deletions

File tree

scratch

Lines changed: 32 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1336,24 +1336,24 @@ Options:
13361336
-n|--no-dep skip dependencies
13371337
-y|--yes skip ask user permission
13381338
--exclude=* exclude dependencies, comma separated
1339-
1339+
13401340
upgrade <ports> <arg> upgrade ports (use pkgbuild arg, except '-i' & '-r')
13411341
-n|--no-dep skip dependencies
13421342
-y|--yes skip ask user permission
13431343
--exclude=* exclude dependencies, comma separated
1344-
1344+
13451345
remove <ports> <arg> remove installed ports (use pkgdel arg)
13461346
-y|--yes skip ask user permission
1347-
1347+
13481348
sysup <arg> full system upgrade (use pkgbuild arg, except '-i', '-r' & '-u')
13491349
-n|--no-dep skip dependencies
13501350
-y|--yes skip ask user permission
13511351
--exclude=* exclude dependencies, comma separated
1352-
1352+
13531353
deplist <ports> print all dependencies for ports
13541354
-q|--quick skip installed ports
13551355
--exclude=* exclude dependencies, comma separated
1356-
1356+
13571357
build <ports> <arg> build ports (use pkgbuild arg, except '-i', '-u', '-r', '-g', & '-p')
13581358
13591359
lock <ports> locking ports prevent upgrade
@@ -1380,11 +1380,13 @@ Options:
13801380
orphan print orphan installed ports
13811381
foreign print foreign ports
13821382
help print this help msg
1383-
1383+
13841384
Global options:
1385-
--repo=<repo path> add custom repo path
1386-
--nocolor disable colour for output
1387-
1385+
--append-repo=<repo path> append custom repo path
1386+
--prepend-repo=<repo path> prepend custom repo path
1387+
--repo-file=<repo file> use custom repo file (default: $REPO_FILE)
1388+
--nocolor disable colour for output
1389+
13881390
EOF
13891391
}
13901392

@@ -1393,16 +1395,6 @@ print_runhelp_msg() {
13931395
exit 2
13941396
}
13951397

1396-
BUILD_SCRIPT="spkgbuild"
1397-
INDEX_DIR="/var/lib/scratchpkg/index"
1398-
REPO_FILE="/etc/scratchpkg.repo"
1399-
ALIAS_FILE="/etc/scratchpkg.alias"
1400-
1401-
# default value from pkgbuild
1402-
SOURCE_DIR="/var/cache/scratchpkg/sources"
1403-
PACKAGE_DIR="/var/cache/scratchpkg/packages"
1404-
COMPRESSION_MODE="xz"
1405-
14061398
mode=$1
14071399

14081400
[ "$mode" ] || {
@@ -1413,19 +1405,31 @@ shift
14131405

14141406
for opt in $@; do
14151407
case $opt in
1416-
--nocolor) nocolor;;
1417-
--repo=*) PORT_REPO="$PORT_REPO ${opt#*=}";;
1418-
--*) MAINOPTS="$MAINOPTS $opt";;
1419-
-*) char=${#opt}; count=1
1420-
while [ "$count" != "$char" ]; do
1421-
count=$((count+1))
1422-
MAINOPTS="$MAINOPTS -$(printf '%s' $opt | cut -c $count)"
1423-
done;;
1424-
*) MAINOPTS="$MAINOPTS $opt";;
1408+
--nocolor) nocolor;;
1409+
--repo=*) PORT_REPO="$PORT_REPO ${opt#*=}";;
1410+
--repo-file=*) REPO_FILE="${opt#*=}";;
1411+
--alias-file=*) ALIAS_FILE="${opt#*=}";;
1412+
--*) MAINOPTS="$MAINOPTS $opt";;
1413+
-*) char=${#opt}; count=1
1414+
while [ "$count" != "$char" ]; do
1415+
count=$((count+1))
1416+
MAINOPTS="$MAINOPTS -$(printf '%s' $opt | cut -c $count)"
1417+
done;;
1418+
*) MAINOPTS="$MAINOPTS $opt";;
14251419
esac
14261420
shift
14271421
done
14281422

1423+
BUILD_SCRIPT="spkgbuild"
1424+
INDEX_DIR="/var/lib/scratchpkg/index"
1425+
REPO_FILE="${REPO_FILE:-/etc/scratchpkg.repo}"
1426+
ALIAS_FILE="${ALIAS_FILE:-/etc/scratchpkg.alias}"
1427+
1428+
# default value from pkgbuild
1429+
SOURCE_DIR="/var/cache/scratchpkg/sources"
1430+
PACKAGE_DIR="/var/cache/scratchpkg/packages"
1431+
COMPRESSION_MODE="xz"
1432+
14291433
if [ -f "$REPO_FILE" ]; then
14301434
for repodir in $(grep -Ev '^(#|$)' "$REPO_FILE" | awk '{print $1}'); do
14311435
PORT_REPO="$PORT_REPO $repodir"

0 commit comments

Comments
 (0)