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
}
error=0
parseopt "$@"
echo "Calculate packages to keep..."
@@ -47,8 +49,10 @@ done
done
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/locale \
usr/local/locale \
usr/local/share/locale
usr/local/share/locale \
usr/lib/locale
}
packaging() {

80
scratch
View File

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