tazpkg rev 846

Remove "busybox" "prefixes" (thanks llev)
We used "busybox wget", etc. to be sure we called Busybox's "wget", not any other "wget". Workaround already done in "getenv" module.
author Aleksej Bobylev <al.bobylev@gmail.com>
date Fri Oct 09 13:14:01 2015 +0300 (2015-10-09)
parents ce7009ff237b
children e54a3ba8cc25
files modules/check modules/convert modules/depends modules/flavor modules/get modules/getenv modules/install modules/mkdb modules/recharge modules/recompress modules/reconfigure tazpkg
line diff
     1.1 --- a/modules/check	Tue Oct 06 15:46:41 2015 +0300
     1.2 +++ b/modules/check	Fri Oct 09 13:14:01 2015 +0300
     1.3 @@ -153,7 +153,7 @@
     1.4  				esac
     1.5  			done
     1.6  			echo "$md5  $f"
     1.7 -		done < "$file" | busybox $CHECKSUM -c - 2>/dev/null | grep -v OK$ | sed "s/: FAILED$//"
     1.8 +		done < "$file" | $CHECKSUM -c - 2>/dev/null | grep -v OK$ | sed "s/: FAILED$//"
     1.9  	done
    1.10  	footer
    1.11  
     2.1 --- a/modules/convert	Tue Oct 06 15:46:41 2015 +0300
     2.2 +++ b/modules/convert	Fri Oct 09 13:14:01 2015 +0300
     2.3 @@ -12,12 +12,10 @@
     2.4  TMP_DIR=$(mktemp -d)
     2.5  TOP_DIR="$(pwd)"
     2.6  
     2.7 -. /etc/slitaz/slitaz.conf
     2.8 -. /lib/libtaz.sh
     2.9  . @@MODULES@@/find-depends
    2.10  
    2.11 -# Internationalization.
    2.12 -export TEXTDOMAIN='tazpkg'
    2.13 +# Get TazPkg working environment
    2.14 +. @@MODULES@@/getenv
    2.15  
    2.16  
    2.17  # FIXME: what does this mean?
    2.18 @@ -213,7 +211,7 @@
    2.19  
    2.20  convert_nutyx() {
    2.21  	mkdir -p "$TMP_DIR/fs"
    2.22 -	busybox tar -xf "$PACKAGE_FILE" -C "$TMP_DIR/fs"
    2.23 +	tar -xf "$PACKAGE_FILE" -C "$TMP_DIR/fs"
    2.24  	if [ -f "$TMP_DIR/fs/.META" ]; then
    2.25  		package=$(sed '/^N/!d;s/^.//' fs/.META)
    2.26  		version=$(sed '/^V/!d;s/^.//' fs/.META)
    2.27 @@ -248,7 +246,7 @@
    2.28  
    2.29  convert_arch() {
    2.30  	mkdir -p "$TMP_DIR/fs"
    2.31 -	busybox tar -xf "$PACKAGE_FILE" -C "$TMP_DIR/fs"
    2.32 +	tar -xf "$PACKAGE_FILE" -C "$TMP_DIR/fs"
    2.33  	if [ -f "$TMP_DIR/fs/.PKGINFO" ]; then
    2.34  		cd "$TMP_DIR"
    2.35  		package=$(   sed '/^pkgname/!d;s/.*= //'  fs/.PKGINFO)
     3.1 --- a/modules/depends	Tue Oct 06 15:46:41 2015 +0300
     3.2 +++ b/modules/depends	Fri Oct 09 13:14:01 2015 +0300
     3.3 @@ -46,7 +46,7 @@
     3.4  	DB='installed'; [ -n "$all" ] && DB='packages'
     3.5  
     3.6  	awk -F$'\t' '$8 {print $1 " " $8}' "$PKGS_DB/$DB.info" | \
     3.7 -	busybox awk -F' ' -v search="$SEARCH" '
     3.8 +	awk -F' ' -v search="$SEARCH" '
     3.9  function show_deps(pkg, space,   i, n, mydeps) {
    3.10  	if (processed[pkg]) return
    3.11  	processed[pkg] = 1;
     4.1 --- a/modules/flavor	Tue Oct 06 15:46:41 2015 +0300
     4.2 +++ b/modules/flavor	Fri Oct 09 13:14:01 2015 +0300
     4.3 @@ -19,7 +19,7 @@
     4.4  	case "$1" in
     4.5  		# Mirror URL can have a trailing slash or not.
     4.6  		http://* | https://* | ftp://*)
     4.7 -			busybox wget -c -q -T 30 -U $UA ${1%/}/$2 2>/dev/null && break ;;
     4.8 +			wget -c -q -T 30 -U $UA ${1%/}/$2 2>/dev/null && break ;;
     4.9  		*)
    4.10  			ln -sf ${1%/}/$2 . && break ;;
    4.11  	esac
     5.1 --- a/modules/get	Tue Oct 06 15:46:41 2015 +0300
     5.2 +++ b/modules/get	Fri Oct 09 13:14:01 2015 +0300
     5.3 @@ -93,9 +93,9 @@
     5.4  	case "$1" in
     5.5  		# Mirror URL can have a trailing slash or not.
     5.6  		http://* | https://* | ftp://*)
     5.7 -			debug "  busybox wget -c -q -T 30 -U $UA ${1%/}/$2"
     5.8 +			debug "  wget -c -q -T 30 -U $UA ${1%/}/$2"
     5.9  			# TODO: display abridged wget status
    5.10 -			busybox wget -c -q -T 30 -U $UA ${1%/}/$2
    5.11 +			wget -c -q -T 30 -U $UA ${1%/}/$2
    5.12  			;;
    5.13  		*)
    5.14  			debug "  ln -sf ${1%/}/$2 ."
    5.15 @@ -173,7 +173,7 @@
    5.16  
    5.17  	# Try converted extra-packages first
    5.18  	# FIXME: Workaround to get packages filenames (even better to have names and versions separate)
    5.19 -	converted="$(busybox wget -O - http://mirror1.slitaz.org/packages/extra/ 2>/dev/null | \
    5.20 +	converted="$(wget -O - http://mirror1.slitaz.org/packages/extra/ 2>/dev/null | \
    5.21  		tr \'\" $'\n' | grep "$1-.*\.tazpkg$" | sort -u)"
    5.22  	debug "converted='$converted'"
    5.23  	if [ -n "$converted" ]; then
    5.24 @@ -181,8 +181,8 @@
    5.25  			http://*|https://*|ftp://*)
    5.26  				# Default 'http://mirror.slitaz.org/packages/cooking/'
    5.27  				#      -> 'http://mirror.slitaz.org/packages/extra/'
    5.28 -				debug "busybox wget -q -T 30 -U '$UA' '${mirror%packages/*}packages/extra/$converted'"
    5.29 -				busybox wget -q -T 30 -U "$UA" "${mirror%packages/*}packages/extra/$converted";;
    5.30 +				debug "wget -q -T 30 -U '$UA' '${mirror%packages/*}packages/extra/$converted'"
    5.31 +				wget -q -T 30 -U "$UA" "${mirror%packages/*}packages/extra/$converted";;
    5.32  		esac
    5.33  		if [ -f "$converted" ]; then
    5.34  			echo "$extra_cache/$converted"; exit 0
    5.35 @@ -196,8 +196,8 @@
    5.36  		http://*|https://*|ftp://*)
    5.37  			# Default 'http://mirror.slitaz.org/packages/cooking/'
    5.38  			#      -> 'http://mirror.slitaz.org/packages/get/'
    5.39 -			debug "busybox wget -q -T 30 -U '$UA' '${mirror%packages/*}packages/get/$1'"
    5.40 -			busybox wget -q -T 30 -U "$UA" "${mirror%packages/*}packages/get/$1";;
    5.41 +			debug "wget -q -T 30 -U '$UA' '${mirror%packages/*}packages/get/$1'"
    5.42 +			wget -q -T 30 -U "$UA" "${mirror%packages/*}packages/get/$1";;
    5.43  	esac
    5.44  
    5.45  	if [ ! -f "$1" ]; then
     6.1 --- a/modules/getenv	Tue Oct 06 15:46:41 2015 +0300
     6.2 +++ b/modules/getenv	Fri Oct 09 13:14:01 2015 +0300
     6.3 @@ -21,7 +21,12 @@
     6.4  die() { longline "$(_ "$@")" >&2; exit 1; }
     6.5  
     6.6  # Show debug messages
     6.7 -debug() { if [ -n "$debug" ]; then colorize 036 "$@" >&2; fi; }
     6.8 +debug() {
     6.9 +	if [ -n "$debug" ]; then
    6.10 +		colorize 036 "$@" >&2
    6.11 +		echo -e "$(date +%f) $@" >> "${LOG/.log/.debug}"
    6.12 +	fi
    6.13 +}
    6.14  
    6.15  debug "\n========\n$0 '$1' '$2' '$3' '$4'"
    6.16  
     7.1 --- a/modules/install	Tue Oct 06 15:46:41 2015 +0300
     7.2 +++ b/modules/install	Fri Oct 09 13:14:01 2015 +0300
     7.3 @@ -78,7 +78,7 @@
     7.4  # Auto install or ask user then install all missing deps from local dir, CD-ROM,
     7.5  # media or from the mirror.
     7.6  
     7.7 -install_all_deps() {				# READY!!!
     7.8 +install_all_deps() {
     7.9  	# input: $1 = package file to check/install missing dependencies
    7.10  	# ROOT READY
    7.11  	# dep: equivalent_pkg.
    7.12 @@ -258,7 +258,7 @@
    7.13  	fi
    7.14  
    7.15  }
    7.16 -
    7.17 +# Post-install commands
    7.18  call_post_install() {
    7.19  	local tmp
    7.20  	if grep -q '^post_install()' "$1"; then
    7.21 @@ -457,13 +457,13 @@
    7.22  	fi
    7.23  
    7.24  
    7.25 -	if [ -n "$(busybox ls fs/* 2>/dev/null)" ]; then
    7.26 +	if [ -n "$(ls fs/* 2>/dev/null)" ]; then
    7.27  		action 'Installing package...'
    7.28  
    7.29  		debug '\n  resolving destination links in source'
    7.30  		IFS=$'\n'
    7.31  		for dir in $(find fs -type d | sed 's|^fs||;/^$/d'); do
    7.32 -			if ldir=$(busybox readlink -n $root$dir); then
    7.33 +			if ldir=$(readlink -n $root$dir); then
    7.34  				debug "  * mv 'fs$dir'\n    -> 'fs${dir%/*}/$ldir'"
    7.35  				mkdir -p "fs${dir%/*}/${ldir%/*}"
    7.36  				mv "fs$dir" "fs${dir%/*}/$ldir"
     8.1 --- a/modules/mkdb	Tue Oct 06 15:46:41 2015 +0300
     8.2 +++ b/modules/mkdb	Fri Oct 09 13:14:01 2015 +0300
     8.3 @@ -211,7 +211,7 @@
     8.4  
     8.5  # Make bundle to fast recharge
     8.6  [ -f 'bundle.tar.lzma' ] && rm 'bundle.tar.lzma'
     8.7 -busybox tar -chaf bundle.tar.lzma \
     8.8 +tar -chaf bundle.tar.lzma \
     8.9  	files-list.md5 packages.info descriptions.txt packages.equiv
    8.10  
    8.11  # Clean up
     9.1 --- a/modules/recharge	Tue Oct 06 15:46:41 2015 +0300
     9.2 +++ b/modules/recharge	Fri Oct 09 13:14:01 2015 +0300
     9.3 @@ -29,7 +29,7 @@
     9.4  get_from_mirror() {
     9.5  	case "$mirror" in
     9.6  		http://* | https://* | ftp://*)
     9.7 -			busybox wget -c -q -T 30 -U "$UA" "$mirror$1" 2>/dev/null;;
     9.8 +			wget -c -q -T 30 -U "$UA" "$mirror$1" 2>/dev/null;;
     9.9  		*)
    9.10  			ln -sf "$mirror$1" .;;
    9.11  	esac
    9.12 @@ -70,7 +70,7 @@
    9.13  esac
    9.14  
    9.15  for path in $repo_to_recharge; do
    9.16 -	[ ! -f "$path/mirror" ] && continue	# skip
    9.17 +	[ ! -s "$path/mirror" ] && continue	# skip
    9.18  	cd "$path"
    9.19  	# Mirror URL will have a trailing slash
    9.20  	mirror=$(cat mirror); mirror="${mirror%/}/"
    9.21 @@ -119,7 +119,7 @@
    9.22  	action 'Getting "%s"...' "$bundle"
    9.23  	get_from_mirror "$bundle"
    9.24  	if [ -f "$bundle" ]; then
    9.25 -		busybox tar -xaf "$bundle"; rm "$bundle"
    9.26 +		tar -xaf "$bundle"; rm "$bundle"
    9.27  	else
    9.28  		recharging_failed "$path"; continue
    9.29  	fi
    10.1 --- a/modules/recompress	Tue Oct 06 15:46:41 2015 +0300
    10.2 +++ b/modules/recompress	Fri Oct 09 13:14:01 2015 +0300
    10.3 @@ -40,12 +40,12 @@
    10.4  extract_package
    10.5  
    10.6  action "Recompressing the FS..."
    10.7 -find fs | busybox cpio -o -H newc --quiet | lzma e fs.cpio.lzma -si
    10.8 +find fs | cpio -o -H newc --quiet | lzma e fs.cpio.lzma -si
    10.9  rm -rf fs
   10.10  status
   10.11  
   10.12  action "Creating new package..."
   10.13 -find | busybox cpio -o -H newc --quiet > "$PACKAGE_FILE"
   10.14 +find | cpio -o -H newc --quiet > "$PACKAGE_FILE"
   10.15  status
   10.16  
   10.17  rm -rf "$TMP_DIR"
    11.1 --- a/modules/reconfigure	Tue Oct 06 15:46:41 2015 +0300
    11.2 +++ b/modules/reconfigure	Fri Oct 09 13:14:01 2015 +0300
    11.3 @@ -15,10 +15,19 @@
    11.4  
    11.5  PACKAGE="$1"
    11.6  
    11.7 -# Check for post_install
    11.8 -if grep -q ^post_install "$INSTALLED/$PACKAGE/receipt"; then
    11.9 -	. "$INSTALLED/$PACKAGE/receipt"
   11.10 -	post_install "$root"
   11.11 +# Receipt function caller
   11.12 +# Why? "Bad" receipt sourcing can redefine some vital TazPkg variables.
   11.13 +# Few receipts function should be patched now.
   11.14 +
   11.15 +# Check for post_install function
   11.16 +if grep -q '^post_install()' "$INSTALLED/$PACKAGE/receipt"; then
   11.17 +	action 'Execute post-install commands...'
   11.18 +	tmp="$(mktemp)"
   11.19 +	cp "$1" "$tmp"
   11.20 +	sed -i 's|$1/*$INSTALLED|$INSTALLED|g' "$tmp"
   11.21 +	( . "$tmp"; post_install "$root" )
   11.22 +	status
   11.23 +	rm "$tmp"
   11.24  	# Log this activity
   11.25  	tazpkg call log_pkg Reconfigured
   11.26  else
    12.1 --- a/tazpkg	Tue Oct 06 15:46:41 2015 +0300
    12.2 +++ b/tazpkg	Fri Oct 09 13:14:01 2015 +0300
    12.3 @@ -90,7 +90,12 @@
    12.4  
    12.5  
    12.6  # Show debug messages
    12.7 -debug() { if [ -n "$debug" ]; then colorize 036 "$@" >&2; fi; }
    12.8 +debug() {
    12.9 +	if [ -n "$debug" ]; then
   12.10 +		colorize 036 "$@" >&2
   12.11 +		echo -e "$(date +%f) $@" >> "${LOG/.log/.debug}"
   12.12 +	fi
   12.13 +}
   12.14  
   12.15  
   12.16  # Check if dir exists