6 Commits
0.7 ... 0.8

Author SHA1 Message Date
emmett1
f0ff3d070e add function to use custom repo and alias file 2020-04-10 22:41:09 +08:00
emmett1
985f59fc97 update alias function 2020-04-10 13:18:13 +08:00
emmett1
2651ad3188 remove pkglocate 2020-04-07 00:39:36 +08:00
emmett1
3602e0a8e8 add locate function 2020-04-07 00:39:12 +08:00
emmett1
c816e3b409 update pkgbase 2020-04-02 16:22:27 +08:00
emmett1
8d4b7902eb add usr/lib/locale to removelocales function 2020-04-02 16:20:02 +08:00
3 changed files with 56 additions and 35 deletions

View File

@@ -28,6 +28,8 @@ Options:
EOF EOF
} }
error=0
parseopt "$@" parseopt "$@"
echo "Calculate packages to keep..." echo "Calculate packages to keep..."
@@ -47,8 +49,10 @@ done
done done
echo "This is dry-run, no real action is run!" echo "This is dry-run, no real action is run!"
} || { } || {
scratch remove $yes $remove scratch remove $yes $remove || error=1
} }
} || {
echo "Already on base, nothing to remove."
} }
exit $? exit $error

View File

@@ -311,7 +311,8 @@ removelocales() {
usr/share/locale \ usr/share/locale \
usr/locale \ usr/locale \
usr/local/locale \ usr/local/locale \
usr/local/share/locale usr/local/share/locale \
usr/lib/locale
} }
packaging() { packaging() {

80
scratch
View File

@@ -100,16 +100,20 @@ allinstalled() {
} }
deps_alias() { deps_alias() {
[ -f $ALIAS_FILE ] || { [ -f "$ALIAS_FILE" ] || {
echo $@ echo $@
return return
} }
while [ "$1" ]; do while [ "$1" ]; do
getalias=$(grep -w ^$1 $ALIAS_FILE | awk '{print $2}') if [ "$(grep -w ^$1 $ALIAS_FILE)" ]; then
echo ${getalias:-$1} getalias=$(grep -w ^$1 $ALIAS_FILE | awk '{print $2}')
[ "$getalias" ] && echo "$getalias"
else
echo "$1"
fi
shift shift
unset getalias
done done
unset getalias
} }
get_depends() { get_depends() {
@@ -206,6 +210,13 @@ scratch_lock() {
done done
} }
scratch_locate() {
needarg $@
for repo in $PORT_REPO; do
grep -R $@ $repo/*/.pkgfiles | sed 's/:/ /;s/\/\.pkgfiles//' | awk '{print $1,$4}' | column -t
done
}
scratch_unlock() { scratch_unlock() {
needroot "Unlocking package" needroot "Unlocking package"
for pkg in "$@"; do for pkg in "$@"; do
@@ -1325,24 +1336,24 @@ Options:
-n|--no-dep skip dependencies -n|--no-dep skip dependencies
-y|--yes skip ask user permission -y|--yes skip ask user permission
--exclude=* exclude dependencies, comma separated --exclude=* exclude dependencies, comma separated
upgrade <ports> <arg> upgrade ports (use pkgbuild arg, except '-i' & '-r') upgrade <ports> <arg> upgrade ports (use pkgbuild arg, except '-i' & '-r')
-n|--no-dep skip dependencies -n|--no-dep skip dependencies
-y|--yes skip ask user permission -y|--yes skip ask user permission
--exclude=* exclude dependencies, comma separated --exclude=* exclude dependencies, comma separated
remove <ports> <arg> remove installed ports (use pkgdel arg) remove <ports> <arg> remove installed ports (use pkgdel arg)
-y|--yes skip ask user permission -y|--yes skip ask user permission
sysup <arg> full system upgrade (use pkgbuild arg, except '-i', '-r' & '-u') sysup <arg> full system upgrade (use pkgbuild arg, except '-i', '-r' & '-u')
-n|--no-dep skip dependencies -n|--no-dep skip dependencies
-y|--yes skip ask user permission -y|--yes skip ask user permission
--exclude=* exclude dependencies, comma separated --exclude=* exclude dependencies, comma separated
deplist <ports> print all dependencies for ports deplist <ports> print all dependencies for ports
-q|--quick skip installed ports -q|--quick skip installed ports
--exclude=* exclude dependencies, comma separated --exclude=* exclude dependencies, comma separated
build <ports> <arg> build ports (use pkgbuild arg, except '-i', '-u', '-r', '-g', & '-p') build <ports> <arg> build ports (use pkgbuild arg, except '-i', '-u', '-r', '-g', & '-p')
lock <ports> locking ports prevent upgrade lock <ports> locking ports prevent upgrade
@@ -1357,6 +1368,7 @@ Options:
readme <port> print readme file, if exist readme <port> print readme file, if exist
files <port> print files installed files <port> print files installed
info <port> print information info <port> print information
locate <files> print location of files in ports repo
sync update ports database sync update ports database
outdate print outdated ports outdate print outdated ports
cache print and clear old pkg and src caches cache print and clear old pkg and src caches
@@ -1368,11 +1380,13 @@ Options:
orphan print orphan installed ports orphan print orphan installed ports
foreign print foreign ports foreign print foreign ports
help print this help msg help print this help msg
Global options: Global options:
--repo=<repo path> add custom repo path --append-repo=<repo path> append custom repo path
--nocolor disable colour for output --prepend-repo=<repo path> prepend custom repo path
--repo-file=<repo file> use custom repo file (default: $REPO_FILE)
--nocolor disable colour for output
EOF EOF
} }
@@ -1381,16 +1395,6 @@ print_runhelp_msg() {
exit 2 exit 2
} }
BUILD_SCRIPT="spkgbuild"
INDEX_DIR="/var/lib/scratchpkg/index"
REPO_FILE="/etc/scratchpkg.repo"
ALIAS_FILE="/etc/scratchpkg.alias"
# default value from pkgbuild
SOURCE_DIR="/var/cache/scratchpkg/sources"
PACKAGE_DIR="/var/cache/scratchpkg/packages"
COMPRESSION_MODE="xz"
mode=$1 mode=$1
[ "$mode" ] || { [ "$mode" ] || {
@@ -1401,19 +1405,31 @@ shift
for opt in $@; do for opt in $@; do
case $opt in case $opt in
--nocolor) nocolor;; --nocolor) nocolor;;
--repo=*) PORT_REPO="$PORT_REPO ${opt#*=}";; --repo=*) PORT_REPO="$PORT_REPO ${opt#*=}";;
--*) MAINOPTS="$MAINOPTS $opt";; --repo-file=*) REPO_FILE="${opt#*=}";;
-*) char=${#opt}; count=1 --alias-file=*) ALIAS_FILE="${opt#*=}";;
while [ "$count" != "$char" ]; do --*) MAINOPTS="$MAINOPTS $opt";;
count=$((count+1)) -*) char=${#opt}; count=1
MAINOPTS="$MAINOPTS -$(printf '%s' $opt | cut -c $count)" while [ "$count" != "$char" ]; do
done;; count=$((count+1))
*) MAINOPTS="$MAINOPTS $opt";; MAINOPTS="$MAINOPTS -$(printf '%s' $opt | cut -c $count)"
done;;
*) MAINOPTS="$MAINOPTS $opt";;
esac esac
shift shift
done done
BUILD_SCRIPT="spkgbuild"
INDEX_DIR="/var/lib/scratchpkg/index"
REPO_FILE="${REPO_FILE:-/etc/scratchpkg.repo}"
ALIAS_FILE="${ALIAS_FILE:-/etc/scratchpkg.alias}"
# default value from pkgbuild
SOURCE_DIR="/var/cache/scratchpkg/sources"
PACKAGE_DIR="/var/cache/scratchpkg/packages"
COMPRESSION_MODE="xz"
if [ -f "$REPO_FILE" ]; then if [ -f "$REPO_FILE" ]; then
for repodir in $(grep -Ev '^(#|$)' "$REPO_FILE" | awk '{print $1}'); do for repodir in $(grep -Ev '^(#|$)' "$REPO_FILE" | awk '{print $1}'); do
PORT_REPO="$PORT_REPO $repodir" PORT_REPO="$PORT_REPO $repodir"