This commit is contained in:
emmett1
2018-11-11 22:51:41 +08:00
parent f0551877c7
commit e8207c87bd
3 changed files with 38 additions and 8 deletions

View File

@@ -11,7 +11,7 @@ REVDEPCONF=/etc/revdep.conf
mkdir -pv ${DESTDIR}{${BINDIR},${CONFDIR},${HOOK_DIR},${PORT_DIR},${REVDEPD}}
touch ${DESTDIR}${REVDEPCONF}
install -m755 revdep pkgadd pkgdel pkgbuild pkgdeplist pkglibdepends scratch ${DESTDIR}${BINDIR}
install -m755 revdep pkgadd pkgdel pkgbuild pkgdeplist pkglibdepends scratch pkgbase ${DESTDIR}${BINDIR}
install -m644 scratchpkg.conf scratchpkg.repo ${DESTDIR}${CONFDIR}
install -m755 extra/* ${DESTDIR}${BINDIR}
mkdir -pv ${DESTDIR}${INDEX_DIR}/index

26
pkgbase Executable file
View File

@@ -0,0 +1,26 @@
#!/bin/bash
keep=$(pkgdeplist -l base | awk '{print $2}')
if [ "$1" ]; then
extrakeep=$(pkgdeplist -l $@ | awk '{print $2}')
fi
keep="$keep $extrakeep"
allinstalled=$(scratch listinst | awk '{print $1}')
for pkg in $allinstalled; do
echo $keep | tr ' ' '\n' | grep -qx $pkg
if [ "$?" != 0 ]; then
if [ "$remove" = "" ]; then
remove=$pkg
else
remove="$remove $pkg"
fi
fi
done
for i in $remove; do
pkgdel $i || exit 1
done
exit $?

18
revdep
View File

@@ -35,7 +35,8 @@ Usage:
Options:
-r, --rebuild rebuild & reinstall broken package
-e, --exclude <pkg1 pkg2 pkgN> exclude package when rebuild (use with -r|--rebuild)
-e, --exclude <pkg1 pkg2 pkgN> exclude package when rebuild (use with -r/--rebuild)
-n, --no-confirm dont ask user confirmation to rebuild package (use with -r/--rebuild)
-h, --help print this help message
EOF
@@ -45,6 +46,7 @@ parse_opt() {
while [ $1 ]; do
case $1 in
-r|--rebuild) REBUILD=1 ;;
-n|--no-confirm) NOCONFIRM=1 ;;
-e|--exclude) while [ "$2" ]; do
case $2 in
-*) break ;;
@@ -92,12 +94,14 @@ rebuild() {
fi
done
done
echo
echo "Package will be rebuild & reinstall by this order:"
echo $order
echo
echo "Press ENTER to continue"
read
if [ "$NOCONFIRM" = "" ]; then
echo
echo "Package will be rebuild & reinstall by this order:"
echo $order
echo
echo "Press ENTER to continue"
read
fi
for p in $order; do
scratch build -f $p && scratch install -r $p || exit 1
done