mirror of
https://github.com/outbackdingo/scratchpkg.git
synced 2026-03-21 20:45:02 +00:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
32b7462f2d | ||
|
|
a1ef1c5b33 | ||
|
|
b72816f8df |
@@ -15,9 +15,9 @@ install -d ${DESTDIR}${REVDEPD}
|
|||||||
install -dm777 ${DESTDIR}${CACHE_DIR}/packages
|
install -dm777 ${DESTDIR}${CACHE_DIR}/packages
|
||||||
install -dm777 ${DESTDIR}${CACHE_DIR}/sources
|
install -dm777 ${DESTDIR}${CACHE_DIR}/sources
|
||||||
install -dm777 ${DESTDIR}${CACHE_DIR}/work
|
install -dm777 ${DESTDIR}${CACHE_DIR}/work
|
||||||
install -dm777 ${DESTDIR}${CACHE_DIR}/log
|
|
||||||
|
|
||||||
install -m755 xchroot revdep pkgadd pkgdel pkgbuild pkgquery scratch updateconf ${DESTDIR}${BINDIR}
|
install -m755 xchroot revdep pkgadd pkgdel pkgbuild pkgquery scratch updateconf \
|
||||||
|
pkgbase pkgdepends pkgrebuild pkgfix portcreate ${DESTDIR}${BINDIR}
|
||||||
install -m644 scratchpkg.conf scratchpkg.repo scratchpkg.alias ${DESTDIR}${CONFDIR}
|
install -m644 scratchpkg.conf scratchpkg.repo scratchpkg.alias ${DESTDIR}${CONFDIR}
|
||||||
|
|
||||||
install -m644 revdep.conf ${DESTDIR}${REVDEPCONF}
|
install -m644 revdep.conf ${DESTDIR}${REVDEPCONF}
|
||||||
|
|||||||
54
pkgbase
Executable file
54
pkgbase
Executable file
@@ -0,0 +1,54 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# script to remove all packages other than base and any user input
|
||||||
|
#
|
||||||
|
|
||||||
|
parseopt() {
|
||||||
|
while [ "$1" ]; do
|
||||||
|
case $1 in
|
||||||
|
-n) dryrun=1;;
|
||||||
|
-y) yes=$1;;
|
||||||
|
-h) printhelp; exit 0;;
|
||||||
|
*) pkg="$pkg $1"
|
||||||
|
esac
|
||||||
|
shift
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
printhelp() {
|
||||||
|
cat << EOF
|
||||||
|
Usage:
|
||||||
|
$(basename $0) [options] [packages]
|
||||||
|
|
||||||
|
Options:
|
||||||
|
-n dry-run
|
||||||
|
-y dont ask user confirmation
|
||||||
|
-h print this help msg
|
||||||
|
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
|
||||||
|
parseopt "$@"
|
||||||
|
|
||||||
|
echo "Calculate packages to keep..."
|
||||||
|
keep=$(scratch deplist base $pkg | awk '{print $2}')
|
||||||
|
|
||||||
|
echo "Calculate selected packages to remove..."
|
||||||
|
for pkg in $(scratch installed | awk '{print $1}'); do
|
||||||
|
echo $keep | tr ' ' '\n' | grep -qx $pkg || {
|
||||||
|
remove="$remove $pkg"
|
||||||
|
}
|
||||||
|
done
|
||||||
|
|
||||||
|
[ "$remove" ] && {
|
||||||
|
[ "$dryrun" = 1 ] && {
|
||||||
|
for i in $remove; do
|
||||||
|
echo "remove: $i..."
|
||||||
|
done
|
||||||
|
echo "This is dry-run, no real action is run!"
|
||||||
|
} || {
|
||||||
|
scratch remove $yes $remove
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
exit $?
|
||||||
55
pkgdepends
Executable file
55
pkgdepends
Executable file
@@ -0,0 +1,55 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
#
|
||||||
|
# script to check dependencies
|
||||||
|
#
|
||||||
|
|
||||||
|
get_libpath() {
|
||||||
|
ldd $1 2>/dev/null | grep $2 | awk '{print $3}'
|
||||||
|
}
|
||||||
|
|
||||||
|
scratch files $1 | while read -r line; do
|
||||||
|
case $line in
|
||||||
|
usr/share/gir-1.0/*.gir) extra_dep="$extra_dep gobject-introspection";;
|
||||||
|
usr/share/vala/vapi/*.vapi) extra_dep="$extra_dep vala";;
|
||||||
|
esac
|
||||||
|
case $line in
|
||||||
|
*/) continue;;
|
||||||
|
esac
|
||||||
|
case "$(file -bi /$line)" in
|
||||||
|
*application/x-sharedlib* | *application/x-executable* | *application/x-pie-executable*)
|
||||||
|
for NEEDED in $(objdump -x /$line | grep NEEDED | awk '{print $2}'); do
|
||||||
|
case $NEEDED in
|
||||||
|
libc.so|libc.so.6) continue;;
|
||||||
|
esac
|
||||||
|
[ "$NEEDED" ] || continue
|
||||||
|
[ -f /"$line" ] || continue
|
||||||
|
libs=$(get_libpath /$line $NEEDED)
|
||||||
|
[ "$libs" ] || continue
|
||||||
|
if ! echo $all_libs | grep -qw $libs; then
|
||||||
|
pkg=$(scratch provide $libs$ | awk '{print $1}' | head -n1)
|
||||||
|
case $pkg in
|
||||||
|
$1|gcc|glibc|musl) continue;;
|
||||||
|
esac
|
||||||
|
[ "$pkg" ] || continue
|
||||||
|
if ! echo $all_pkgs | grep -qw $pkg; then
|
||||||
|
echo $pkg
|
||||||
|
all_pkgs="$all_pkgs $pkg"
|
||||||
|
unset pkg
|
||||||
|
fi
|
||||||
|
all_libs="$all_libs $libs"
|
||||||
|
unset libs
|
||||||
|
fi
|
||||||
|
done ;;
|
||||||
|
esac
|
||||||
|
[ "$extra_dep" ] && {
|
||||||
|
for e in $extra_dep; do
|
||||||
|
if ! echo $all_pkgs | grep -qw $e; then
|
||||||
|
echo $e
|
||||||
|
all_pkgs="$all_pkgs $e"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
done
|
||||||
|
|
||||||
|
exit 0
|
||||||
140
pkgfix
Executable file
140
pkgfix
Executable file
@@ -0,0 +1,140 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# Copyright (c) 2019 by Emmett1 (emmett1.2miligrams@gmail.com)
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# script to detect broken kernel modules after kernel update
|
||||||
|
# need to use with 'scratchpkg'
|
||||||
|
#
|
||||||
|
|
||||||
|
export LANG=C
|
||||||
|
|
||||||
|
get_perlmodules() {
|
||||||
|
command -v perl >/dev/null || return
|
||||||
|
perlpath=$(dirname $(perl -V:sitearch | grep -o "'.*'" | sed "s/'//g"))
|
||||||
|
for i in $(dirname $perlpath)/*; do
|
||||||
|
[ "$perlpath" = "$i" ] && continue
|
||||||
|
brokenpkg="$brokenpkg $(scratch provide $i/$ | awk '{print $1}')"
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
get_modules() {
|
||||||
|
[ -f /lib/modules/KERNELVERSION ] || return
|
||||||
|
KERVER=$(cat /lib/modules/KERNELVERSION)
|
||||||
|
for i in /lib/modules/*; do
|
||||||
|
case $i in
|
||||||
|
/lib/modules/KERNELVERSION|/lib/modules/$KERVER) continue ;;
|
||||||
|
esac
|
||||||
|
brokenpkg="$brokenpkg $(scratch provide $i/$ | awk '{print $1}')"
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
get_rubygem() {
|
||||||
|
command -v gem >/dev/null || return
|
||||||
|
gempath=$(gem env gemdir)
|
||||||
|
for i in $(dirname $gempath)/*; do
|
||||||
|
[ "$gempath" = "$i" ] && continue
|
||||||
|
brokenpkg="$brokenpkg $(scratch provide $i/$ | awk '{print $1}')"
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
sort_modules() {
|
||||||
|
for all in $(scratch deplist $brokenpkg | cut -d ' ' -f2); do
|
||||||
|
for r in $brokenpkg; do
|
||||||
|
if [ $r = $all ]; then
|
||||||
|
if [ -z "$order" ]; then
|
||||||
|
order="$all"
|
||||||
|
else
|
||||||
|
order="$order $all"
|
||||||
|
fi
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
confirm() {
|
||||||
|
printf "$1 (Y/n) "
|
||||||
|
read -r response
|
||||||
|
case "$response" in
|
||||||
|
[Nn][Oo]|[Nn]) echo "$2"; return 2 ;;
|
||||||
|
*) : ;;
|
||||||
|
esac
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
usage() {
|
||||||
|
cat << EOF
|
||||||
|
Usage:
|
||||||
|
$(basename $0) [options]
|
||||||
|
|
||||||
|
Options:
|
||||||
|
-r rebuild & reinstall broken package
|
||||||
|
-y dont ask user confirmation to rebuild package (use with -r)
|
||||||
|
-h print this help message
|
||||||
|
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
|
||||||
|
parse_opt() {
|
||||||
|
while [ "$1" ]; do
|
||||||
|
case $1 in
|
||||||
|
-r) REBUILD=1 ;;
|
||||||
|
-y) YES=1 ;;
|
||||||
|
-h) usage; exit 0 ;;
|
||||||
|
*) echo "Invalid option ($1)"; exit 1 ;;
|
||||||
|
esac
|
||||||
|
shift
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
parse_opt $@
|
||||||
|
|
||||||
|
if [ "$REBUILD" ] && [ "$(id -u)" != 0 ]; then
|
||||||
|
echo "Rebuild broken packages required root!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
get_modules
|
||||||
|
get_perlmodules
|
||||||
|
get_rubygem
|
||||||
|
|
||||||
|
if [ "$brokenpkg" ]; then
|
||||||
|
sort_modules
|
||||||
|
else
|
||||||
|
echo "No broken packages found."
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$REBUILD" = 1 ]; then
|
||||||
|
[ "$YES" ] || {
|
||||||
|
echo
|
||||||
|
echo "Package will be rebuild & reinstall by this order:"
|
||||||
|
echo " $order"
|
||||||
|
echo
|
||||||
|
confirm "Continue rebuild & reinstall broken packages?" "Operation cancelled."
|
||||||
|
}
|
||||||
|
for p in $order; do
|
||||||
|
scratch build -f $p && scratch install -r $p || exit 1
|
||||||
|
done
|
||||||
|
else
|
||||||
|
echo "Broken packages:"
|
||||||
|
for p in $order; do
|
||||||
|
echo " $p"
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
exit 0
|
||||||
340
pkgquery
340
pkgquery
@@ -18,342 +18,6 @@
|
|||||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
#
|
#
|
||||||
|
|
||||||
msg() {
|
echo "*** ${0##*/} is deprecated, please use 'scratch' instead ***"
|
||||||
echo "==> $1"
|
|
||||||
}
|
|
||||||
|
|
||||||
msgerr() {
|
exit 0
|
||||||
msg "ERROR: $*"
|
|
||||||
}
|
|
||||||
|
|
||||||
msgwarn() {
|
|
||||||
msg "WARNING: $*"
|
|
||||||
}
|
|
||||||
|
|
||||||
msginst() {
|
|
||||||
echo "[i] $1"
|
|
||||||
}
|
|
||||||
|
|
||||||
msgmiss() {
|
|
||||||
echo "[m] $1"
|
|
||||||
}
|
|
||||||
|
|
||||||
msgnoinst() {
|
|
||||||
echo "[-] $1"
|
|
||||||
}
|
|
||||||
|
|
||||||
needarg() {
|
|
||||||
[ "$*" ] || {
|
|
||||||
msgerr "This operation required an arguments!"
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
isinstalled() {
|
|
||||||
if [ -s "$INDEX_DIR/$1/.pkginfo" ] && [ "$(grep $1 $INDEX_DIR/$1/.pkginfo)" ]; then
|
|
||||||
return 0
|
|
||||||
else
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
allinstalled() {
|
|
||||||
grep ^name "$INDEX_DIR"/*/.pkginfo | awk '{print $3}'
|
|
||||||
}
|
|
||||||
|
|
||||||
installed_pkg_info() {
|
|
||||||
if isinstalled $1; then
|
|
||||||
grep ^$2 "$INDEX_DIR/$1/.pkginfo" | cut -d " " -f3-
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
deps_alias() {
|
|
||||||
[ -f $ALIAS_FILE ] || {
|
|
||||||
echo $@
|
|
||||||
return
|
|
||||||
}
|
|
||||||
while [ "$1" ]; do
|
|
||||||
getalias=$(grep -w ^$1 $ALIAS_FILE | awk '{print $2}')
|
|
||||||
echo ${getalias:-$1}
|
|
||||||
shift
|
|
||||||
done
|
|
||||||
unset getalias
|
|
||||||
}
|
|
||||||
|
|
||||||
getdepends() {
|
|
||||||
ppath=$(getportpath $1) || return 0
|
|
||||||
deps=$(grep "^# depends[[:blank:]]*:" $ppath/$BUILD_SCRIPT \
|
|
||||||
| sed 's/^# depends[[:blank:]]*:[[:blank:]]*//' \
|
|
||||||
| tr ' ' '\n' \
|
|
||||||
| awk '!a[$0]++' \
|
|
||||||
| sed 's/,//')
|
|
||||||
deps_alias $deps
|
|
||||||
}
|
|
||||||
|
|
||||||
getportpath() {
|
|
||||||
for repo in $REPO; do
|
|
||||||
if [ -f $repo/$1/$BUILD_SCRIPT ]; then
|
|
||||||
dirname $repo/$1/$BUILD_SCRIPT
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
|
|
||||||
pkg_dependent() {
|
|
||||||
needarg $@
|
|
||||||
if [ "$(getportpath $1)" ]; then
|
|
||||||
grep -R "# depends[[:blank:]]*:" $REPO \
|
|
||||||
| sed "s,:# depends[[:blank:]]*:[[:blank:]]*,#|,;s, ,|,g;s,$,|,g" \
|
|
||||||
| grep "|$1|" \
|
|
||||||
| awk -F "#" '{print $1}' \
|
|
||||||
| rev \
|
|
||||||
| awk -F / '{print $2}' \
|
|
||||||
| rev
|
|
||||||
else
|
|
||||||
msgerr "Port '$1' not exist."
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
pkg_orphan() {
|
|
||||||
tmpallpkg="/tmp/.pkgquery_allpkg.$$"
|
|
||||||
tmpalldep="/tmp/.pkgquery_alldep.$$"
|
|
||||||
for pkg in $(allinstalled); do
|
|
||||||
echo $pkg >> $tmpallpkg
|
|
||||||
dep="$dep $(getdepends $pkg)"
|
|
||||||
done
|
|
||||||
echo $dep | tr ' ' '\n' | sort | uniq > "$tmpalldep"
|
|
||||||
grep -xvF -f "$tmpalldep" "$tmpallpkg"
|
|
||||||
rm "$tmpalldep" "$tmpallpkg"
|
|
||||||
}
|
|
||||||
|
|
||||||
pkg_dup() {
|
|
||||||
dup=$(find $REPO -type d -print | grep -Exv "($(echo $REPO | tr ' ' '|'))" | \
|
|
||||||
rev | cut -d '/' -f1 | rev | sort | uniq -d)
|
|
||||||
|
|
||||||
if [ "$dup" ]; then
|
|
||||||
for dp in $dup; do
|
|
||||||
for repo in $REPO; do
|
|
||||||
[ -d $repo/$dp ] && echo "$repo/$dp"
|
|
||||||
done
|
|
||||||
done
|
|
||||||
else
|
|
||||||
msg "No duplicate ports found."
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
pkg_foreign() {
|
|
||||||
for pkg in $(allinstalled); do
|
|
||||||
if ! getportpath $pkg >/dev/null; then
|
|
||||||
iname=$(installed_pkg_info $pkg name)
|
|
||||||
iversion=$(installed_pkg_info $pkg version)
|
|
||||||
irelease=$(installed_pkg_info $pkg release)
|
|
||||||
echo "$iname $iversion-$irelease"
|
|
||||||
fi
|
|
||||||
unset iname iversion irelease
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
pkg_search() {
|
|
||||||
needarg $@
|
|
||||||
arg=$*
|
|
||||||
for repo in $REPO; do
|
|
||||||
out=$(grep -R "# description" $repo | grep $BUILD_SCRIPT | grep "$arg" | awk -F : '{print $1}' | sort)
|
|
||||||
[ "$out" ] || continue
|
|
||||||
for line in $out; do
|
|
||||||
repo=$(echo $line | rev | awk -F / '{print $3}' | rev)
|
|
||||||
desc=$(grep "^# description[[:blank:]]*:" $line | sed 's/^# description[[:blank:]]*:[[:blank:]]*//')
|
|
||||||
. $line
|
|
||||||
echo "($repo) $name $version-$release: $desc"
|
|
||||||
unset repo desc name version release build
|
|
||||||
done
|
|
||||||
unset out
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
pkg_locked() {
|
|
||||||
for pkg in $(allinstalled); do
|
|
||||||
[ -f "$INDEX_DIR/$pkg/.lock" ] && echo "$pkg"
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
pkg_installed() {
|
|
||||||
for all in $(allinstalled); do
|
|
||||||
printf "%s" "$all "
|
|
||||||
grep -e ^version -e ^release $INDEX_DIR/$all/.pkginfo | awk '{print $3}' | tr '\n' '-' | sed 's:\-$::'
|
|
||||||
echo
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
pkg_missingdep() {
|
|
||||||
for pkg in $(allinstalled); do
|
|
||||||
if getportpath "$pkg" >/dev/null; then
|
|
||||||
depends=$(getdepends $pkg)
|
|
||||||
fi
|
|
||||||
if [ "$depends" ]; then
|
|
||||||
for d in $depends; do
|
|
||||||
if ! isinstalled $d; then
|
|
||||||
if [ -z "$msd" ]; then
|
|
||||||
msd="$d"
|
|
||||||
else
|
|
||||||
msd="$msd $d"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
[ "$msd" ] && echo "$pkg: $msd"
|
|
||||||
unset depends msd
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
pkg_info() {
|
|
||||||
needarg $@
|
|
||||||
ppath=$(getportpath $1) || return 1
|
|
||||||
|
|
||||||
. $ppath/$BUILD_SCRIPT
|
|
||||||
desc=$(grep "^# description[[:blank:]]*:" $ppath/$BUILD_SCRIPT | sed 's/^# description[[:blank:]]*:[[:blank:]]*//')
|
|
||||||
url=$(grep "^# homepage[[:blank:]]*:" $ppath/$BUILD_SCRIPT | sed 's/^# homepage[[:blank:]]*:[[:blank:]]*//')
|
|
||||||
maint=$(grep "^# maintainer[[:blank:]]*:" $ppath/$BUILD_SCRIPT | sed 's/^# maintainer[[:blank:]]*:[[:blank:]]*//')
|
|
||||||
deps=$(getdepends $1 | tr '\n' ' ')
|
|
||||||
|
|
||||||
echo "Name: $1"
|
|
||||||
echo "Path: $ppath"
|
|
||||||
echo "Version: $version"
|
|
||||||
echo "Release: $release"
|
|
||||||
echo "Description: $desc"
|
|
||||||
echo "Homepage: $url"
|
|
||||||
echo "Maintainer: $maint"
|
|
||||||
echo "Dependencies: $deps"
|
|
||||||
}
|
|
||||||
|
|
||||||
pkg_depends() {
|
|
||||||
needarg $@
|
|
||||||
if getportpath "$1" >/dev/null; then
|
|
||||||
depends=$(getdepends $1)
|
|
||||||
else
|
|
||||||
msgerr "Port '$1' not exist."
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
for dep in $depends; do
|
|
||||||
if isinstalled $dep; then
|
|
||||||
msginst "$dep"
|
|
||||||
elif getportpath $dep >/dev/null; then
|
|
||||||
msgnoinst "$dep"
|
|
||||||
else
|
|
||||||
msgmiss "$dep"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
pkg_path() {
|
|
||||||
needarg $@
|
|
||||||
if PPATH=$(getportpath "$1"); then
|
|
||||||
echo "$PPATH"
|
|
||||||
else
|
|
||||||
msgerr "Port '$1' not exist."
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
pkg_provide() {
|
|
||||||
needarg $@
|
|
||||||
arg=$(echo $1 | sed "s/^\///")
|
|
||||||
grep -R "$arg" $INDEX_DIR/*/.files \
|
|
||||||
| sed "s:$INDEX_DIR/::" \
|
|
||||||
| sed "s:/.files::" \
|
|
||||||
| tr : " " \
|
|
||||||
| column -t
|
|
||||||
}
|
|
||||||
|
|
||||||
pkg_readme() {
|
|
||||||
needarg $@
|
|
||||||
if PPATH=$(getportpath "$1"); then
|
|
||||||
if [ -f "$PPATH/readme" ]; then
|
|
||||||
cat "$PPATH/readme"
|
|
||||||
else
|
|
||||||
msgerr "Port '$1' does not have readme."
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
msgerr "Port '$1' not exist."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
pkg_files() {
|
|
||||||
needarg $@
|
|
||||||
if isinstalled $1; then
|
|
||||||
cat "$INDEX_DIR/$1/.files"
|
|
||||||
else
|
|
||||||
msg "Package '$1' not installed."
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
pkg_cat() {
|
|
||||||
needarg $@
|
|
||||||
if PPATH=$(getportpath "$1"); then
|
|
||||||
cat "$PPATH/$BUILD_SCRIPT"
|
|
||||||
else
|
|
||||||
msgerr "Port '$1' not exist."
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
pkg_help() {
|
|
||||||
cat << EOF
|
|
||||||
Usage:
|
|
||||||
$(basename $0) <options> [<arg>]
|
|
||||||
|
|
||||||
Options:
|
|
||||||
search <pattern> find ports in repo
|
|
||||||
cat <port> print spkgbuild
|
|
||||||
depends <port> print dependencies
|
|
||||||
dependent <port> print dependent
|
|
||||||
path <port> print path in repo
|
|
||||||
provide <files> print port's provided files
|
|
||||||
readme <port> print readme file, if exist
|
|
||||||
files <port> print files installed
|
|
||||||
info <port> print information
|
|
||||||
dup print duplicate ports in repo
|
|
||||||
installed print all installed ports
|
|
||||||
locked print loacked ports
|
|
||||||
missingdep print missing dependencies
|
|
||||||
orphan print orphan installed ports
|
|
||||||
foreign print foreign ports
|
|
||||||
help print this help msg
|
|
||||||
|
|
||||||
EOF
|
|
||||||
}
|
|
||||||
|
|
||||||
print_runhelp_msg() {
|
|
||||||
echo "Run '$(basename $0) help' to see available options."
|
|
||||||
exit 2
|
|
||||||
}
|
|
||||||
|
|
||||||
BUILD_SCRIPT="spkgbuild"
|
|
||||||
INDEX_DIR="/var/lib/scratchpkg/index"
|
|
||||||
REPO_FILE="/etc/scratchpkg.repo"
|
|
||||||
ALIAS_FILE="/etc/scratchpkg.alias"
|
|
||||||
|
|
||||||
if [ -f "$REPO_FILE" ]; then
|
|
||||||
for repodir in $(grep -Ev '^(#|$)' "$REPO_FILE" | awk '{print $1}'); do
|
|
||||||
REPO="$REPO $repodir"
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
|
|
||||||
opts=$1
|
|
||||||
|
|
||||||
if [ -z "$opts" ]; then
|
|
||||||
print_runhelp_msg
|
|
||||||
fi
|
|
||||||
|
|
||||||
shift
|
|
||||||
|
|
||||||
if [ $(command -v pkg_$opts) ]; then
|
|
||||||
pkg_$opts "$@"
|
|
||||||
else
|
|
||||||
print_runhelp_msg
|
|
||||||
fi
|
|
||||||
|
|
||||||
exit $?
|
|
||||||
|
|||||||
33
pkgrebuild
Executable file
33
pkgrebuild
Executable file
@@ -0,0 +1,33 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# script to rebuild base packages in right toolchain order
|
||||||
|
#
|
||||||
|
|
||||||
|
LIST="/tmp/$(basename $0)-list"
|
||||||
|
touch $LIST
|
||||||
|
|
||||||
|
TOOLCHAIN="linux-api-headers glibc-pass1 binutils-pass1 gcc binutils glibc"
|
||||||
|
|
||||||
|
#scratch sync || exit 1
|
||||||
|
|
||||||
|
for tc in $TOOLCHAIN; do
|
||||||
|
if [ ! $(grep -x $tc $LIST) ]; then
|
||||||
|
pkgname="$(echo $tc | sed 's/-pass1//')"
|
||||||
|
scratch build -f $pkgname || exit 1
|
||||||
|
echo $tc >> $LIST
|
||||||
|
scratch install -r $pkgname --no-backup || exit 1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
for pkg in $(scratch deplist base | awk '{print $2}'); do
|
||||||
|
case $pkg in
|
||||||
|
linux-api-headers|musl|gcc|binutils|glibc) continue;;
|
||||||
|
esac
|
||||||
|
if [ ! $(grep -x $pkg $LIST) ]; then
|
||||||
|
scratch build -f $pkg || exit 1
|
||||||
|
echo $pkg >> $LIST
|
||||||
|
scratch install -r $pkg --no-backup || exit 1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
exit 0
|
||||||
48
portcreate
Executable file
48
portcreate
Executable file
@@ -0,0 +1,48 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# scratchpkg
|
||||||
|
#
|
||||||
|
# Copyright (c) 2018 by Emmett1 (emmett1.2miligrams@gmail.com)
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
#
|
||||||
|
|
||||||
|
if [ -d "$1" ]; then
|
||||||
|
echo "ERROR: Directory '$1' already exist!"
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
mkdir "$1"
|
||||||
|
echo "# description :
|
||||||
|
# homepage :
|
||||||
|
# maintainer :
|
||||||
|
# depends :
|
||||||
|
|
||||||
|
name=$1
|
||||||
|
version=
|
||||||
|
release=1
|
||||||
|
options=\"\"
|
||||||
|
noextract=\"\"
|
||||||
|
backup=\"\"
|
||||||
|
source=\"\"
|
||||||
|
|
||||||
|
build() {
|
||||||
|
cd \$name-\$version
|
||||||
|
./configure --prefix=/usr
|
||||||
|
make
|
||||||
|
make DESTDIR=\$PKG install
|
||||||
|
}" > "$1"/spkgbuild
|
||||||
|
echo "Template port have created for '$1'."
|
||||||
|
fi
|
||||||
|
|
||||||
|
exit 0
|
||||||
270
scratch
270
scratch
@@ -481,7 +481,6 @@ scratch_build() {
|
|||||||
while [ "$1" ]; do
|
while [ "$1" ]; do
|
||||||
case $1 in
|
case $1 in
|
||||||
-i|-u|-r|-g|-p) ;;
|
-i|-u|-r|-g|-p) ;;
|
||||||
--log) LOGBUILD=1;;
|
|
||||||
-*) OPTS="$OPTS $1";;
|
-*) OPTS="$OPTS $1";;
|
||||||
*) PKGNAME="$PKGNAME $1";;
|
*) PKGNAME="$PKGNAME $1";;
|
||||||
esac
|
esac
|
||||||
@@ -498,12 +497,7 @@ scratch_build() {
|
|||||||
}
|
}
|
||||||
cd $ppath
|
cd $ppath
|
||||||
settermtitle "Building $pkg..."
|
settermtitle "Building $pkg..."
|
||||||
if [ "$LOGBUILD" = 1 ]; then
|
pkgbuild $OPTS || {
|
||||||
pkgbuild $OPTS | tee $LOG_DIR/$pkg.log
|
|
||||||
else
|
|
||||||
pkgbuild $OPTS
|
|
||||||
fi
|
|
||||||
[ "$?" = 0 ] || {
|
|
||||||
settermtitle "Building $pkg failed."
|
settermtitle "Building $pkg failed."
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
@@ -520,7 +514,6 @@ scratch_install() {
|
|||||||
-r|--reinstall) REINSTALL=1;;
|
-r|--reinstall) REINSTALL=1;;
|
||||||
-y|--yes) NOCONFIRM=1;;
|
-y|--yes) NOCONFIRM=1;;
|
||||||
-n|--no-dep) NO_DEP=1;;
|
-n|--no-dep) NO_DEP=1;;
|
||||||
--log) LOGBUILD=1;;
|
|
||||||
--exclude=*) EXOPT=$1;;
|
--exclude=*) EXOPT=$1;;
|
||||||
-*) OPTS="$OPTS $1";;
|
-*) OPTS="$OPTS $1";;
|
||||||
*) PKGNAME="$PKGNAME $1";;
|
*) PKGNAME="$PKGNAME $1";;
|
||||||
@@ -542,12 +535,7 @@ scratch_install() {
|
|||||||
else
|
else
|
||||||
cd $(getportpath $ii)
|
cd $(getportpath $ii)
|
||||||
settermtitle "Reinstalling $ii..."
|
settermtitle "Reinstalling $ii..."
|
||||||
if [ "$LOGBUILD" = 1 ]; then
|
pkgbuild $OPTS -r || {
|
||||||
pkgbuild $OPTS -r | tee $LOG_DIR/$ii.log
|
|
||||||
else
|
|
||||||
pkgbuild $OPTS -r
|
|
||||||
fi
|
|
||||||
[ "$?" = 0 ] || {
|
|
||||||
error=1
|
error=1
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
@@ -571,12 +559,7 @@ scratch_install() {
|
|||||||
else
|
else
|
||||||
cd $(getportpath $ii)
|
cd $(getportpath $ii)
|
||||||
settermtitle "Installing $ii..."
|
settermtitle "Installing $ii..."
|
||||||
if [ "$LOGBUILD" = 1 ]; then
|
pkgbuild -i $OPTS || {
|
||||||
pkgbuild $OPTS -i | tee $LOG_DIR/$ii.log
|
|
||||||
else
|
|
||||||
pkgbuild $OPTS -i
|
|
||||||
fi
|
|
||||||
[ "$?" = 0 ] || {
|
|
||||||
error=1
|
error=1
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
@@ -623,12 +606,7 @@ scratch_install() {
|
|||||||
if portpathh=$(getportpath $int); then
|
if portpathh=$(getportpath $int); then
|
||||||
cd $portpathh
|
cd $portpathh
|
||||||
settermtitle "[ $count/$total ] installing $int..."
|
settermtitle "[ $count/$total ] installing $int..."
|
||||||
if [ "$LOGBUILD" = 1 ]; then
|
pkgbuild -i $OPTS || {
|
||||||
pkgbuild $OPTS -i | tee $LOG_DIR/$int.log
|
|
||||||
else
|
|
||||||
pkgbuild $OPTS -i
|
|
||||||
fi
|
|
||||||
[ "$?" = 0 ] || {
|
|
||||||
error=1
|
error=1
|
||||||
count=$(( count - 1 ))
|
count=$(( count - 1 ))
|
||||||
break
|
break
|
||||||
@@ -722,7 +700,6 @@ scratch_sysup() {
|
|||||||
-i|-u|-r) ;;
|
-i|-u|-r) ;;
|
||||||
-y|--yes) NOCONFIRM=1;;
|
-y|--yes) NOCONFIRM=1;;
|
||||||
-n|--no-dep) NODEP=1;;
|
-n|--no-dep) NODEP=1;;
|
||||||
--log) LOGBUILD=1;;
|
|
||||||
--exclude=*) EXOPT=$1;;
|
--exclude=*) EXOPT=$1;;
|
||||||
-*) OPTS="$OPTS $1";;
|
-*) OPTS="$OPTS $1";;
|
||||||
esac
|
esac
|
||||||
@@ -779,24 +756,14 @@ scratch_sysup() {
|
|||||||
cd $(getportpath $inst)
|
cd $(getportpath $inst)
|
||||||
if ! isinstalled $inst; then
|
if ! isinstalled $inst; then
|
||||||
settermtitle "[ $count/$total ] Installing $inst..."
|
settermtitle "[ $count/$total ] Installing $inst..."
|
||||||
if [ "$LOGBUILD" = 1 ]; then
|
pkgbuild -i $OPTS || {
|
||||||
pkgbuild $OPTS -i | tee $LOG_DIR/$inst.log
|
|
||||||
else
|
|
||||||
pkgbuild $OPTS -i
|
|
||||||
fi
|
|
||||||
[ "$?" = 0 ] || {
|
|
||||||
error=1
|
error=1
|
||||||
count=$(( count - 1 ))
|
count=$(( count - 1 ))
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
settermtitle "[ $count/$total ] Upgrading $inst..."
|
settermtitle "[ $count/$total ] Upgrading $inst..."
|
||||||
if [ "$LOGBUILD" = 1 ]; then
|
pkgbuild -u $OPTS || {
|
||||||
pkgbuild $OPTS -u | tee $LOG_DIR/$inst.log
|
|
||||||
else
|
|
||||||
pkgbuild $OPTS-u
|
|
||||||
fi
|
|
||||||
[ "$?" = 0 ] || {
|
|
||||||
error=1
|
error=1
|
||||||
count=$(( count - 1 ))
|
count=$(( count - 1 ))
|
||||||
break
|
break
|
||||||
@@ -818,7 +785,6 @@ scratch_upgrade() {
|
|||||||
-i|-r) ;;
|
-i|-r) ;;
|
||||||
-y|--yes) NOCONFIRM=1;;
|
-y|--yes) NOCONFIRM=1;;
|
||||||
-d|--no-dep) NO_DEP=1;;
|
-d|--no-dep) NO_DEP=1;;
|
||||||
--log) LOGBUILD=1;;
|
|
||||||
--exclude=*) EXOPT=$1;;
|
--exclude=*) EXOPT=$1;;
|
||||||
-*) OPTS="$OPTS $1";;
|
-*) OPTS="$OPTS $1";;
|
||||||
*) PKGNAME="$PKGNAME $1";;
|
*) PKGNAME="$PKGNAME $1";;
|
||||||
@@ -887,24 +853,14 @@ scratch_upgrade() {
|
|||||||
cd $(getportpath $inst)
|
cd $(getportpath $inst)
|
||||||
if ! isinstalled $inst; then
|
if ! isinstalled $inst; then
|
||||||
settermtitle "[ $count/$total ] Installing $inst..."
|
settermtitle "[ $count/$total ] Installing $inst..."
|
||||||
if [ "$LOGBUILD" = 1 ]; then
|
pkgbuild -i $OPTS || {
|
||||||
pkgbuild $OPTS -i | tee $LOG_DIR/$inst.log
|
|
||||||
else
|
|
||||||
pkgbuild $OPTS -i
|
|
||||||
fi
|
|
||||||
[ "$?" = 0 ] || {
|
|
||||||
error=1
|
error=1
|
||||||
count=$(( count - 1 ))
|
count=$(( count - 1 ))
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
settermtitle "[ $count/$total ] Upgrading $inst..."
|
settermtitle "[ $count/$total ] Upgrading $inst..."
|
||||||
if [ "$LOGBUILD" = 1 ]; then
|
pkgbuild -u $OPTS || {
|
||||||
pkgbuild $OPTS -u | tee $LOG_DIR/$inst.log
|
|
||||||
else
|
|
||||||
pkgbuild $OPTS -u
|
|
||||||
fi
|
|
||||||
[ "$?" = 0 ] || {
|
|
||||||
error=1
|
error=1
|
||||||
count=$(( count - 1 ))
|
count=$(( count - 1 ))
|
||||||
break
|
break
|
||||||
@@ -1175,6 +1131,189 @@ deplist() {
|
|||||||
CHECK=$(echo $CHECK | sed "s/$1//")
|
CHECK=$(echo $CHECK | sed "s/$1//")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
scratch_cat() {
|
||||||
|
needarg $@
|
||||||
|
if PPATH=$(getportpath "$1"); then
|
||||||
|
cat "$PPATH/$BUILD_SCRIPT"
|
||||||
|
else
|
||||||
|
msgerr "Port '$1' not exist."
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
scratch_dependent() {
|
||||||
|
needarg $@
|
||||||
|
if [ "$(getportpath $1)" ]; then
|
||||||
|
grep -R "# depends[[:blank:]]*:" $PORT_REPO \
|
||||||
|
| sed "s,:# depends[[:blank:]]*:[[:blank:]]*,#|,;s, ,|,g;s,$,|,g" \
|
||||||
|
| grep "|$1|" \
|
||||||
|
| awk -F "#" '{print $1}' \
|
||||||
|
| rev \
|
||||||
|
| awk -F / '{print $2}' \
|
||||||
|
| rev
|
||||||
|
else
|
||||||
|
msgerr "Port '$1' not exist."
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
scratch_depends() {
|
||||||
|
needarg $@
|
||||||
|
if getportpath "$1" >/dev/null; then
|
||||||
|
depends=$(get_depends $1)
|
||||||
|
else
|
||||||
|
msgerr "Port '$1' not exist."
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
for dep in $depends; do
|
||||||
|
if isinstalled $dep; then
|
||||||
|
msginst "$dep"
|
||||||
|
elif getportpath $dep >/dev/null; then
|
||||||
|
msgnoinst "$dep"
|
||||||
|
else
|
||||||
|
msgmiss "$dep"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
scratch_dup() {
|
||||||
|
dup=$(find $PORT_REPO -type d -print | grep -Exv "($(echo $PORT_REPO | tr ' ' '|'))" | \
|
||||||
|
rev | cut -d '/' -f1 | rev | sort | uniq -d)
|
||||||
|
|
||||||
|
if [ "$dup" ]; then
|
||||||
|
for dp in $dup; do
|
||||||
|
for repo in $PORT_REPO; do
|
||||||
|
[ -d $repo/$dp ] && echo "$repo/$dp"
|
||||||
|
done
|
||||||
|
done
|
||||||
|
else
|
||||||
|
msg "No duplicate ports found."
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
scratch_foreign() {
|
||||||
|
for pkg in $(allinstalled); do
|
||||||
|
if ! getportpath $pkg >/dev/null; then
|
||||||
|
iname=$(installed_pkg_info name $pkg)
|
||||||
|
iversion=$(installed_pkg_info version $pkg)
|
||||||
|
irelease=$(installed_pkg_info release $pkg)
|
||||||
|
echo "$iname $iversion-$irelease"
|
||||||
|
fi
|
||||||
|
unset iname iversion irelease
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
scratch_info() {
|
||||||
|
needarg $@
|
||||||
|
ppath=$(getportpath $1) || return 1
|
||||||
|
|
||||||
|
. $ppath/$BUILD_SCRIPT
|
||||||
|
desc=$(grep "^# description[[:blank:]]*:" $ppath/$BUILD_SCRIPT | sed 's/^# description[[:blank:]]*:[[:blank:]]*//')
|
||||||
|
url=$(grep "^# homepage[[:blank:]]*:" $ppath/$BUILD_SCRIPT | sed 's/^# homepage[[:blank:]]*:[[:blank:]]*//')
|
||||||
|
maint=$(grep "^# maintainer[[:blank:]]*:" $ppath/$BUILD_SCRIPT | sed 's/^# maintainer[[:blank:]]*:[[:blank:]]*//')
|
||||||
|
deps=$(get_depends $1 | tr '\n' ' ')
|
||||||
|
|
||||||
|
echo "Name: $1"
|
||||||
|
echo "Path: $ppath"
|
||||||
|
echo "Version: $version"
|
||||||
|
echo "Release: $release"
|
||||||
|
echo "Description: $desc"
|
||||||
|
echo "Homepage: $url"
|
||||||
|
echo "Maintainer: $maint"
|
||||||
|
echo "Dependencies: $deps"
|
||||||
|
}
|
||||||
|
|
||||||
|
scratch_installed() {
|
||||||
|
for all in $(allinstalled); do
|
||||||
|
printf "%s" "$all "
|
||||||
|
grep -e ^version -e ^release $INDEX_DIR/$all/.pkginfo | awk '{print $3}' | tr '\n' '-' | sed 's:\-$::'
|
||||||
|
echo
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
scratch_missingdep() {
|
||||||
|
for pkg in $(allinstalled); do
|
||||||
|
if getportpath "$pkg" >/dev/null; then
|
||||||
|
depends=$(get_depends $pkg)
|
||||||
|
fi
|
||||||
|
if [ "$depends" ]; then
|
||||||
|
for d in $depends; do
|
||||||
|
if ! isinstalled $d; then
|
||||||
|
if [ -z "$msd" ]; then
|
||||||
|
msd="$d"
|
||||||
|
else
|
||||||
|
msd="$msd $d"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
[ "$msd" ] && echo "$pkg: $msd"
|
||||||
|
unset depends msd
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
scratch_locked() {
|
||||||
|
for pkg in $(allinstalled); do
|
||||||
|
[ -f "$INDEX_DIR/$pkg/.lock" ] && echo "$pkg"
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
scratch_orphan() {
|
||||||
|
tmpallpkg="/tmp/.pkgquery_allpkg.$$"
|
||||||
|
tmpalldep="/tmp/.pkgquery_alldep.$$"
|
||||||
|
for pkg in $(allinstalled); do
|
||||||
|
echo $pkg >> $tmpallpkg
|
||||||
|
dep="$dep $(get_depends $pkg)"
|
||||||
|
done
|
||||||
|
echo $dep | tr ' ' '\n' | sort | uniq > "$tmpalldep"
|
||||||
|
grep -xvF -f "$tmpalldep" "$tmpallpkg"
|
||||||
|
rm "$tmpalldep" "$tmpallpkg"
|
||||||
|
}
|
||||||
|
|
||||||
|
scratch_path() {
|
||||||
|
needarg $@
|
||||||
|
if PPATH=$(getportpath "$1"); then
|
||||||
|
echo "$PPATH"
|
||||||
|
else
|
||||||
|
msgerr "Port '$1' not exist."
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
scratch_provide() {
|
||||||
|
needarg $@
|
||||||
|
arg=$(echo $1 | sed "s/^\///")
|
||||||
|
grep -R "$arg" $INDEX_DIR/*/.files \
|
||||||
|
| sed "s:$INDEX_DIR/::" \
|
||||||
|
| sed "s:/.files::" \
|
||||||
|
| tr : " " \
|
||||||
|
| column -t
|
||||||
|
}
|
||||||
|
|
||||||
|
scratch_readme() {
|
||||||
|
needarg $@
|
||||||
|
if PPATH=$(getportpath "$1"); then
|
||||||
|
if [ -f "$PPATH/readme" ]; then
|
||||||
|
cat "$PPATH/readme"
|
||||||
|
else
|
||||||
|
msgerr "Port '$1' does not have readme."
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
msgerr "Port '$1' not exist."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
scratch_files() {
|
||||||
|
needarg $@
|
||||||
|
if isinstalled $1; then
|
||||||
|
cat "$INDEX_DIR/$1/.files"
|
||||||
|
else
|
||||||
|
msg "Package '$1' not installed."
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
scratch_help() {
|
scratch_help() {
|
||||||
cat << EOF
|
cat << EOF
|
||||||
Usage:
|
Usage:
|
||||||
@@ -1185,13 +1324,11 @@ Options:
|
|||||||
-r|--reinstall reinstall
|
-r|--reinstall reinstall
|
||||||
-n|--no-dep skip dependencies
|
-n|--no-dep skip dependencies
|
||||||
-y|--yes skip ask user permission
|
-y|--yes skip ask user permission
|
||||||
--log log build process
|
|
||||||
--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
|
||||||
--log log build process
|
|
||||||
--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)
|
||||||
@@ -1200,7 +1337,6 @@ Options:
|
|||||||
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
|
||||||
--log log build process
|
|
||||||
--exclude=* exclude dependencies, comma separated
|
--exclude=* exclude dependencies, comma separated
|
||||||
|
|
||||||
deplist <ports> print all dependencies for ports
|
deplist <ports> print all dependencies for ports
|
||||||
@@ -1208,16 +1344,29 @@ Options:
|
|||||||
--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')
|
||||||
--log log build process
|
|
||||||
|
|
||||||
lock <ports> locking ports prevent upgrade
|
lock <ports> locking ports prevent upgrade
|
||||||
unlock <ports> unlock locked ports
|
unlock <ports> unlock locked ports
|
||||||
trigger [ports] run system trigger
|
trigger [ports] run system trigger
|
||||||
|
search <pattern> find ports in repo
|
||||||
|
cat <port> print spkgbuild
|
||||||
|
depends <port> print dependencies
|
||||||
|
dependent <port> print dependent
|
||||||
|
path <port> print path in repo
|
||||||
|
provide <files> print port's provided files
|
||||||
|
readme <port> print readme file, if exist
|
||||||
|
files <port> print files installed
|
||||||
|
info <port> print information
|
||||||
sync update ports database
|
sync update ports database
|
||||||
search <pattern> find ports in repo
|
|
||||||
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
|
||||||
integrity check installed port integrity
|
integrity check installed port integrity
|
||||||
|
dup print duplicate ports in repo
|
||||||
|
installed print all installed ports
|
||||||
|
locked print loacked ports
|
||||||
|
missingdep print missing dependencies
|
||||||
|
orphan print orphan installed ports
|
||||||
|
foreign print foreign ports
|
||||||
help print this help msg
|
help print this help msg
|
||||||
|
|
||||||
Global options:
|
Global options:
|
||||||
@@ -1240,7 +1389,6 @@ ALIAS_FILE="/etc/scratchpkg.alias"
|
|||||||
# default value from pkgbuild
|
# default value from pkgbuild
|
||||||
SOURCE_DIR="/var/cache/scratchpkg/sources"
|
SOURCE_DIR="/var/cache/scratchpkg/sources"
|
||||||
PACKAGE_DIR="/var/cache/scratchpkg/packages"
|
PACKAGE_DIR="/var/cache/scratchpkg/packages"
|
||||||
LOG_DIR="/var/cache/scratchpkg/log"
|
|
||||||
COMPRESSION_MODE="xz"
|
COMPRESSION_MODE="xz"
|
||||||
|
|
||||||
mode=$1
|
mode=$1
|
||||||
|
|||||||
22
xchroot
22
xchroot
@@ -1,4 +1,7 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# script to enter chroot
|
||||||
|
#
|
||||||
|
|
||||||
printhelp() {
|
printhelp() {
|
||||||
cat << EOF
|
cat << EOF
|
||||||
@@ -14,6 +17,13 @@ EOF
|
|||||||
msgerr() {
|
msgerr() {
|
||||||
echo "ERROR: $*"
|
echo "ERROR: $*"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unmount() {
|
||||||
|
while true; do
|
||||||
|
mountpoint -q $1 || break
|
||||||
|
umount $1 2>/dev/null
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
[ "$(id -u)" = "0" ] || {
|
[ "$(id -u)" = "0" ] || {
|
||||||
msgerr "$(basename $0) need root access!"
|
msgerr "$(basename $0) need root access!"
|
||||||
@@ -78,13 +88,13 @@ retval=$?
|
|||||||
mv $TARGET/etc/resolv.conf.tmp $TARGET/etc/resolv.conf
|
mv $TARGET/etc/resolv.conf.tmp $TARGET/etc/resolv.conf
|
||||||
}
|
}
|
||||||
|
|
||||||
umount -l $TARGET/dev/pts
|
unmount $TARGET/dev/pts
|
||||||
umount -l $TARGET/dev
|
unmount $TARGET/dev
|
||||||
umount -l $TARGET/run
|
unmount $TARGET/run
|
||||||
umount -l $TARGET/proc
|
unmount $TARGET/proc
|
||||||
if [ -n "$EFI_SYSTEM" ]; then
|
if [ -n "$EFI_SYSTEM" ]; then
|
||||||
umount -l $TARGET/sys/firmware/efi/efivars
|
unmount $TARGET/sys/firmware/efi/efivars
|
||||||
fi
|
fi
|
||||||
umount -l $TARGET/sys
|
unmount $TARGET/sys
|
||||||
|
|
||||||
exit $retval
|
exit $retval
|
||||||
|
|||||||
Reference in New Issue
Block a user