mirror of
https://github.com/outbackdingo/scratchpkg.git
synced 2026-03-21 19:45:00 +00:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9b186bfd31 | ||
|
|
8e8c62d338 | ||
|
|
c8b2eca5ba | ||
|
|
a23a22c659 |
@@ -15,6 +15,7 @@ install -d ${DESTDIR}${REVDEPD}
|
||||
install -dm777 ${DESTDIR}${CACHE_DIR}/packages
|
||||
install -dm777 ${DESTDIR}${CACHE_DIR}/sources
|
||||
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 -m644 scratchpkg.conf scratchpkg.repo scratchpkg.alias ${DESTDIR}${CONFDIR}
|
||||
|
||||
7
pkgbuild
7
pkgbuild
@@ -98,9 +98,14 @@ download_src() {
|
||||
FILENAME=$(basename $FILE)
|
||||
SRCURL=$FILE
|
||||
fi
|
||||
[ "$DOWNLOAD_PROG" = "auto" ] && {
|
||||
command -v curl >/dev/null && DOWNLOAD_PROG=curl
|
||||
command -v wget >/dev/null && DOWNLOAD_PROG=wget
|
||||
}
|
||||
case $DOWNLOAD_PROG in
|
||||
curl) DLCMD="curl -C - -L --fail --ftp-pasv --retry 3 --retry-delay 3 -o $SOURCE_DIR/$FILENAME.partial $CURL_OPTS" ;;
|
||||
wget) DLCMD="wget -c --passive-ftp --no-directories --tries=3 --waitretry=3 --output-document=$SOURCE_DIR/$FILENAME.partial $WGET_OPTS" ;;
|
||||
*) msgerr "No download agent found"; abort 1;;
|
||||
esac
|
||||
if [ "$FILENAME" != "$FILE" ]; then
|
||||
if [ ! -f "$SOURCE_DIR/$FILENAME" ] || [ "$REDOWNLOAD_SOURCE" ]; then
|
||||
@@ -691,7 +696,7 @@ PKGBUILD_BSCRIPT="spkgbuild"
|
||||
SOURCE_DIR="/var/cache/scratchpkg/sources"
|
||||
PACKAGE_DIR="/var/cache/scratchpkg/packages"
|
||||
WORK_DIR="/var/cache/scratchpkg/work"
|
||||
DOWNLOAD_PROG="wget"
|
||||
DOWNLOAD_PROG="auto"
|
||||
COMPRESSION_MODE="xz"
|
||||
|
||||
OPTIONS="!libtool emptydirs strip zipman buildflags makeflags checksum !docs !locales"
|
||||
|
||||
146
scratch
146
scratch
@@ -481,6 +481,7 @@ scratch_build() {
|
||||
while [ "$1" ]; do
|
||||
case $1 in
|
||||
-i|-u|-r|-g|-p) ;;
|
||||
--log) LOGBUILD=1;;
|
||||
-*) OPTS="$OPTS $1";;
|
||||
*) PKGNAME="$PKGNAME $1";;
|
||||
esac
|
||||
@@ -497,7 +498,12 @@ scratch_build() {
|
||||
}
|
||||
cd $ppath
|
||||
settermtitle "Building $pkg..."
|
||||
pkgbuild $OPTS || {
|
||||
if [ "$LOGBUILD" = 1 ]; then
|
||||
pkgbuild $OPTS | tee $LOG_DIR/$pkg.log
|
||||
else
|
||||
pkgbuild $OPTS
|
||||
fi
|
||||
[ "$?" = 0 ] || {
|
||||
settermtitle "Building $pkg failed."
|
||||
return 1
|
||||
}
|
||||
@@ -514,6 +520,7 @@ scratch_install() {
|
||||
-r|--reinstall) REINSTALL=1;;
|
||||
-y|--yes) NOCONFIRM=1;;
|
||||
-n|--no-dep) NO_DEP=1;;
|
||||
--log) LOGBUILD=1;;
|
||||
--exclude=*) EXOPT=$1;;
|
||||
-*) OPTS="$OPTS $1";;
|
||||
*) PKGNAME="$PKGNAME $1";;
|
||||
@@ -535,7 +542,12 @@ scratch_install() {
|
||||
else
|
||||
cd $(getportpath $ii)
|
||||
settermtitle "Reinstalling $ii..."
|
||||
pkgbuild $OPTS -r || {
|
||||
if [ "$LOGBUILD" = 1 ]; then
|
||||
pkgbuild $OPTS -r | tee $LOG_DIR/$ii.log
|
||||
else
|
||||
pkgbuild $OPTS -r
|
||||
fi
|
||||
[ "$?" = 0 ] || {
|
||||
error=1
|
||||
break
|
||||
}
|
||||
@@ -559,7 +571,12 @@ scratch_install() {
|
||||
else
|
||||
cd $(getportpath $ii)
|
||||
settermtitle "Installing $ii..."
|
||||
pkgbuild -i $OPTS || {
|
||||
if [ "$LOGBUILD" = 1 ]; then
|
||||
pkgbuild $OPTS -i | tee $LOG_DIR/$ii.log
|
||||
else
|
||||
pkgbuild $OPTS -i
|
||||
fi
|
||||
[ "$?" = 0 ] || {
|
||||
error=1
|
||||
break
|
||||
}
|
||||
@@ -606,7 +623,12 @@ scratch_install() {
|
||||
if portpathh=$(getportpath $int); then
|
||||
cd $portpathh
|
||||
settermtitle "[ $count/$total ] installing $int..."
|
||||
pkgbuild -i $OPTS || {
|
||||
if [ "$LOGBUILD" = 1 ]; then
|
||||
pkgbuild $OPTS -i | tee $LOG_DIR/$int.log
|
||||
else
|
||||
pkgbuild $OPTS -i
|
||||
fi
|
||||
[ "$?" = 0 ] || {
|
||||
error=1
|
||||
count=$(( count - 1 ))
|
||||
break
|
||||
@@ -700,6 +722,7 @@ scratch_sysup() {
|
||||
-i|-u|-r) ;;
|
||||
-y|--yes) NOCONFIRM=1;;
|
||||
-n|--no-dep) NODEP=1;;
|
||||
--log) LOGBUILD=1;;
|
||||
--exclude=*) EXOPT=$1;;
|
||||
-*) OPTS="$OPTS $1";;
|
||||
esac
|
||||
@@ -756,14 +779,24 @@ scratch_sysup() {
|
||||
cd $(getportpath $inst)
|
||||
if ! isinstalled $inst; then
|
||||
settermtitle "[ $count/$total ] Installing $inst..."
|
||||
pkgbuild -i $OPTS || {
|
||||
if [ "$LOGBUILD" = 1 ]; then
|
||||
pkgbuild $OPTS -i | tee $LOG_DIR/$inst.log
|
||||
else
|
||||
pkgbuild $OPTS -i
|
||||
fi
|
||||
[ "$?" = 0 ] || {
|
||||
error=1
|
||||
count=$(( count - 1 ))
|
||||
break
|
||||
}
|
||||
else
|
||||
settermtitle "[ $count/$total ] Upgrading $inst..."
|
||||
pkgbuild -u $OPTS || {
|
||||
if [ "$LOGBUILD" = 1 ]; then
|
||||
pkgbuild $OPTS -u | tee $LOG_DIR/$inst.log
|
||||
else
|
||||
pkgbuild $OPTS-u
|
||||
fi
|
||||
[ "$?" = 0 ] || {
|
||||
error=1
|
||||
count=$(( count - 1 ))
|
||||
break
|
||||
@@ -785,6 +818,7 @@ scratch_upgrade() {
|
||||
-i|-r) ;;
|
||||
-y|--yes) NOCONFIRM=1;;
|
||||
-d|--no-dep) NO_DEP=1;;
|
||||
--log) LOGBUILD=1;;
|
||||
--exclude=*) EXOPT=$1;;
|
||||
-*) OPTS="$OPTS $1";;
|
||||
*) PKGNAME="$PKGNAME $1";;
|
||||
@@ -797,78 +831,89 @@ scratch_upgrade() {
|
||||
}
|
||||
for pkg in $PKGNAME; do
|
||||
if ! isinstalled $pkg; then
|
||||
msgerr "Package '$pkg' not installed."
|
||||
echo "Package '$pkg' not installed."
|
||||
continue
|
||||
elif [ ! $(getportpath $pkg) ]; then
|
||||
msgerr "Package '$pkg' not exist."
|
||||
echo "Package '$pkg' not exist."
|
||||
continue
|
||||
else
|
||||
. $(getportpath $pkg)/$BUILD_SCRIPT
|
||||
if [ "$(installed_pkg_info version $pkg)-$(installed_pkg_info release $pkg)" = "$version-$release" ]; then
|
||||
msg "Package '$pkg' is up to date."
|
||||
echo "Package '$pkg' is up to date."
|
||||
continue
|
||||
fi
|
||||
fi
|
||||
upkg="$upkg $pkg"
|
||||
done
|
||||
[ "$upkg" ] || return 0
|
||||
[ "$NO_DEP" ] || {
|
||||
|
||||
UPGPKG=0
|
||||
NEWPKG=0
|
||||
if [ "$NODEP" != 1 ]; then
|
||||
echo "Resolving dependencies..."
|
||||
DEP=$(scratch_deplist $upkg $EXOPT | awk '{print $2}')
|
||||
for dep in $DEP; do
|
||||
if ! isinstalled $dep; then
|
||||
[ "$(getportpath $dep)" ] && newpkg="$newpkg $dep"
|
||||
echo
|
||||
for d in $DEP; do
|
||||
if [ "$(echo $upkg | tr ' ' '\n' | grep -x $d)" = "$d" ]; then
|
||||
printf "[${GREEN}u${CRESET}] $d "
|
||||
WILLINSTALL="$WILLINSTALL $d"
|
||||
UPGPKG=$(( UPGPKG + 1 ))
|
||||
elif ! isinstalled $d && [ "$(getportpath "$d")" ]; then
|
||||
printf "[${CYAN}n${CRESET}] $d "
|
||||
WILLINSTALL="$WILLINSTALL $d"
|
||||
NEWPKG=$(( NEWPKG + 1 ))
|
||||
fi
|
||||
done
|
||||
}
|
||||
echo
|
||||
tnew=0
|
||||
tup=0
|
||||
for i in $newpkg; do
|
||||
tnew=$(( tnew + 1 ))
|
||||
printf "[${CYAN}n${CRESET}] $i "
|
||||
done
|
||||
for i in $upkg; do
|
||||
tup=$(( tup + 1 ))
|
||||
printf "[${GREEN}u${CRESET}] $i "
|
||||
done
|
||||
else
|
||||
echo
|
||||
for dd in $upkg; do
|
||||
printf "[${GREEN}u${CRESET}] $dd "
|
||||
WILLINSTALL="$WILLINSTALL $dd"
|
||||
UPGPKG=$(( UPGPKG + 1 ))
|
||||
done
|
||||
fi
|
||||
echo; echo
|
||||
echo "( $tup upgrade, $tnew new install )"
|
||||
echo "( $UPGPKG upgrade, $NEWPKG new install )"
|
||||
echo
|
||||
[ "$NOCONFIRM" ] || {
|
||||
confirm "Continue upgrade/install these package(s)?" "Package upgrade cancelled." || exit $?
|
||||
echo
|
||||
}
|
||||
total=$(( tup + tnew ))
|
||||
count=0
|
||||
error=0
|
||||
if [ "$newpkg" ]; then
|
||||
for pkg in $newpkg; do
|
||||
count=$(( count + 1 ))
|
||||
cd $(getportpath $pkg)
|
||||
settermtitle "[ $count/$total ] Installing $pkg..."
|
||||
pkgbuild -i $OPTS || {
|
||||
error=1
|
||||
count=$(( count - 1 ))
|
||||
break
|
||||
}
|
||||
done_pkg="$done_pkg $pkg"
|
||||
cd - >/dev/null
|
||||
done
|
||||
fi
|
||||
for pkg in $upkg; do # upgrade all target packages
|
||||
count=0
|
||||
total=$(echo $WILLINSTALL | wc -w)
|
||||
for inst in $WILLINSTALL; do # install all required dependencies and target packages itself
|
||||
count=$(( count + 1 ))
|
||||
cd $(getportpath $pkg)
|
||||
settermtitle "[ $count/$total ] Upgrading $pkg..."
|
||||
pkgbuild -u $OPTS || {
|
||||
cd $(getportpath $inst)
|
||||
if ! isinstalled $inst; then
|
||||
settermtitle "[ $count/$total ] Installing $inst..."
|
||||
if [ "$LOGBUILD" = 1 ]; then
|
||||
pkgbuild $OPTS -i | tee $LOG_DIR/$inst.log
|
||||
else
|
||||
pkgbuild $OPTS -i
|
||||
fi
|
||||
[ "$?" = 0 ] || {
|
||||
error=1
|
||||
count=$(( count - 1 ))
|
||||
break
|
||||
}
|
||||
done_pkg="$done_pkg $pkg"
|
||||
else
|
||||
settermtitle "[ $count/$total ] Upgrading $inst..."
|
||||
if [ "$LOGBUILD" = 1 ]; then
|
||||
pkgbuild $OPTS -u | tee $LOG_DIR/$inst.log
|
||||
else
|
||||
pkgbuild $OPTS -u
|
||||
fi
|
||||
[ "$?" = 0 ] || {
|
||||
error=1
|
||||
count=$(( count - 1 ))
|
||||
break
|
||||
}
|
||||
fi
|
||||
cd - >/dev/null
|
||||
done_pkg="$done_pkg $inst"
|
||||
done
|
||||
settermtitle "triggering upgrade hook..."
|
||||
settermtitle "Triggering install hook."
|
||||
[ "$done_pkg" ] && scratch_trigger $done_pkg
|
||||
settermtitle "$count/$total package(s) upgraded."
|
||||
return "$error"
|
||||
@@ -1140,11 +1185,13 @@ Options:
|
||||
-r|--reinstall reinstall
|
||||
-n|--no-dep skip dependencies
|
||||
-y|--yes skip ask user permission
|
||||
--log log build process
|
||||
--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
|
||||
--log log build process
|
||||
--exclude=* exclude dependencies, comma separated
|
||||
|
||||
remove <ports> <arg> remove installed ports (use pkgdel arg)
|
||||
@@ -1153,6 +1200,7 @@ Options:
|
||||
sysup <arg> full system upgrade (use pkgbuild arg, except '-i', '-r' & '-u')
|
||||
-n|--no-dep skip dependencies
|
||||
-y|--yes skip ask user permission
|
||||
--log log build process
|
||||
--exclude=* exclude dependencies, comma separated
|
||||
|
||||
deplist <ports> print all dependencies for ports
|
||||
@@ -1160,6 +1208,7 @@ Options:
|
||||
--exclude=* exclude dependencies, comma separated
|
||||
|
||||
build <ports> <arg> build ports (use pkgbuild arg, except '-i', '-u', '-r', '-g', & '-p')
|
||||
--log log build process
|
||||
|
||||
lock <ports> locking ports prevent upgrade
|
||||
unlock <ports> unlock locked ports
|
||||
@@ -1191,6 +1240,7 @@ ALIAS_FILE="/etc/scratchpkg.alias"
|
||||
# default value from pkgbuild
|
||||
SOURCE_DIR="/var/cache/scratchpkg/sources"
|
||||
PACKAGE_DIR="/var/cache/scratchpkg/packages"
|
||||
LOG_DIR="/var/cache/scratchpkg/log"
|
||||
COMPRESSION_MODE="xz"
|
||||
|
||||
mode=$1
|
||||
|
||||
@@ -9,7 +9,7 @@ MAKEFLAGS="-j$(nproc)"
|
||||
# SOURCE_DIR="/var/cache/scratchpkg/sources"
|
||||
# PACKAGE_DIR="/var/cache/scratchpkg/packages"
|
||||
# WORK_DIR="/var/cache/scratchpkg/work"
|
||||
# DOWNLOAD_PROG="wget"
|
||||
# DOWNLOAD_PROG="auto"
|
||||
# WGET_OPTS=""
|
||||
# CURL_OPTS=""
|
||||
# COMPRESSION_MODE="xz"
|
||||
|
||||
12
xchroot
12
xchroot
@@ -78,13 +78,13 @@ retval=$?
|
||||
mv $TARGET/etc/resolv.conf.tmp $TARGET/etc/resolv.conf
|
||||
}
|
||||
|
||||
umount $TARGET/dev/pts
|
||||
umount $TARGET/dev
|
||||
umount $TARGET/run
|
||||
umount $TARGET/proc
|
||||
umount -l $TARGET/dev/pts
|
||||
umount -l $TARGET/dev
|
||||
umount -l $TARGET/run
|
||||
umount -l $TARGET/proc
|
||||
if [ -n "$EFI_SYSTEM" ]; then
|
||||
umount $TARGET/sys/firmware/efi/efivars
|
||||
umount -l $TARGET/sys/firmware/efi/efivars
|
||||
fi
|
||||
umount $TARGET/sys
|
||||
umount -l $TARGET/sys
|
||||
|
||||
exit $retval
|
||||
|
||||
Reference in New Issue
Block a user