tazpkg rev 880

Global quite mode provided by libtaz.sh now; few tweaks.
author Aleksej Bobylev <al.bobylev@gmail.com>
date Fri Dec 04 02:42:03 2015 +0200 (2015-12-04)
parents a3c27a443a4d
children 847a0d1f8f24
files applications/tazpkg-box.desktop modules/get modules/getenv modules/install
line diff
     1.1 --- a/applications/tazpkg-box.desktop	Wed Dec 02 12:43:47 2015 +0100
     1.2 +++ b/applications/tazpkg-box.desktop	Fri Dec 04 02:42:03 2015 +0200
     1.3 @@ -7,5 +7,5 @@
     1.4  Name[ru]=Менеджер пакетов TazPkg
     1.5  Exec=tazbox su tazpkg-box actions %f
     1.6  Icon=tazpkg
     1.7 -NoDisplay=True
     1.8 +NoDisplay=true
     1.9  MimeType=application/x-tazpkg;
     2.1 --- a/modules/get	Wed Dec 02 12:43:47 2015 +0100
     2.2 +++ b/modules/get	Fri Dec 04 02:42:03 2015 +0200
     2.3 @@ -403,7 +403,7 @@
     2.4  	if [ -z "$forced" ]; then
     2.5  		awk -F$'\t' -vpv="$1" '$1==pv { exit 1 }' "$PKGS_DB/installed.info"
     2.6  		if [ "$?" -eq 1 ]; then
     2.7 -			(
     2.8 +			[ -z "$quiet" ] && (
     2.9  				newline
    2.10  				_ '"%s" package is already installed.' "$(colorize 34 "$1")"
    2.11  				longline "$(_ 'You can use the --forced option to force installation.')"
     3.1 --- a/modules/getenv	Wed Dec 02 12:43:47 2015 +0100
     3.2 +++ b/modules/getenv	Fri Dec 04 02:42:03 2015 +0200
     3.3 @@ -193,32 +193,4 @@
     3.4  CUR_DIR="$(pwd)"
     3.5  
     3.6  
     3.7 -# Quiet functions
     3.8 -
     3.9 -saved_action=''
    3.10 -qaction() {
    3.11 -	saved_action="$1"
    3.12 -	[ -z "$quiet" ] && action "$1";
    3.13 -}
    3.14 -
    3.15 -qstatus() {
    3.16 -	local ret_code=$?
    3.17 -	if [ -z "$quiet" ]; then
    3.18 -		test "$ret_code" -eq 0; status
    3.19 -	elif [ "$ret_code" -ne 0 ]; then
    3.20 -		# Show both action and it's status in the silent mode if error
    3.21 -		action "$saved_action"
    3.22 -		test 1 -eq 2; status
    3.23 -	fi
    3.24 -}
    3.25 -
    3.26 -qtitle() {
    3.27 -	[ -z "$quiet" ] && title "$@";
    3.28 -}
    3.29 -
    3.30 -qfooter() {
    3.31 -	[ -z "$quiet" ] && footer "$@";
    3.32 -}
    3.33 -
    3.34 -
    3.35  debug '-- end getenv --'
     4.1 --- a/modules/install	Wed Dec 02 12:43:47 2015 +0100
     4.2 +++ b/modules/install	Fri Dec 04 02:42:03 2015 +0200
     4.3 @@ -106,7 +106,7 @@
     4.4  			missing_packages="$missing_packages $equiv"
     4.5  			num=$((num+1))
     4.6  		elif [ ! -f "$INSTALLED/$equiv/receipt" ]; then
     4.7 -			_ 'WARNING! Dependency loop between "%s" and "%s".' "$PACKAGE" "$equiv"
     4.8 +			[ -z "$quiet" ] && _ 'WARNING! Dependency loop between "%s" and "%s".' "$PACKAGE" "$equiv"
     4.9  		fi
    4.10  	done
    4.11  
    4.12 @@ -114,7 +114,7 @@
    4.13  	[ -z "$num" ] && return
    4.14  
    4.15  
    4.16 -	qtitle "$(_ 'Tracking dependencies for package "%s"' "$PACKAGE")"
    4.17 +	title "$(_ 'Tracking dependencies for package "%s"' "$PACKAGE")"
    4.18  
    4.19  	# Individual messages for each missing package
    4.20  	[ -z "$quiet" ] && \
    4.21 @@ -122,7 +122,7 @@
    4.22  		_ 'Missing package "%s"' "$pkg"
    4.23  	done
    4.24  
    4.25 -	qfooter "$(_p \
    4.26 +	footer "$(_p \
    4.27  		'%s missing package to install.' \
    4.28  		'%s missing packages to install.' "$num" \
    4.29  		"$num")"
    4.30 @@ -189,7 +189,7 @@
    4.31  extract_package() {
    4.32  	# input: $1 - path to package to be extracted; package should be in the current dir
    4.33  	# ROOT INDEPENDENT
    4.34 -	qaction 'Extracting package...'
    4.35 +	action 'Extracting package...'
    4.36  
    4.37  	# Extract "outer layer": cpio; remove the original package file
    4.38  	cpio -idm --quiet < "$1" && rm -f "$1"
    4.39 @@ -203,7 +203,7 @@
    4.40  		zcat fs.cpio.gz | cpio -idm --quiet && rm fs.cpio.gz
    4.41  	fi
    4.42  
    4.43 -	qstatus
    4.44 +	status
    4.45  }
    4.46  
    4.47  
    4.48 @@ -249,12 +249,12 @@
    4.49  call_pre_install() {
    4.50  	local tmp
    4.51  	if grep -q '^pre_install()' "$1"; then
    4.52 -		qaction 'Execute pre-install commands...'
    4.53 +		action 'Execute pre-install commands...'
    4.54  		tmp="$(mktemp)"
    4.55  		cp "$1" "$tmp"
    4.56  		sed -i 's|$1/*$INSTALLED|$INSTALLED|g' "$tmp"
    4.57  		( . "$tmp"; pre_install "$root" )
    4.58 -		qstatus
    4.59 +		status
    4.60  		rm "$tmp"
    4.61  	fi
    4.62  
    4.63 @@ -263,12 +263,12 @@
    4.64  call_post_install() {
    4.65  	local tmp
    4.66  	if grep -q '^post_install()' "$1"; then
    4.67 -		qaction 'Execute post-install commands...'
    4.68 +		action 'Execute post-install commands...'
    4.69  		tmp="$(mktemp)"
    4.70  		cp "$1" "$tmp"
    4.71  		sed -i 's|$1/*$INSTALLED|$INSTALLED|g' "$tmp"
    4.72  		( . "$tmp"; post_install "$root" )
    4.73 -		qstatus
    4.74 +		status
    4.75  		rm "$tmp"
    4.76  	fi
    4.77  }
    4.78 @@ -333,9 +333,9 @@
    4.79  	#[ -n "$INSTALL_LIST" ] && echo "$PACKAGE_FILE" >> "$PKGS_DB/$INSTALL_LIST-processed"
    4.80  
    4.81  	if [ -n "$sequence" ]; then
    4.82 -		qtitle 'Installation of package "%s" (%s)' "$PACKAGE" "$sequence"
    4.83 +		title 'Installation of package "%s" (%s)' "$PACKAGE" "$sequence"
    4.84  	else
    4.85 -		qtitle 'Installation of package "%s"' "$PACKAGE"
    4.86 +		title 'Installation of package "%s"' "$PACKAGE"
    4.87  	fi
    4.88  
    4.89  	if [ -z "$quiet" ]; then
    4.90 @@ -343,9 +343,9 @@
    4.91  		separator '-'
    4.92  	fi
    4.93  
    4.94 -	qaction 'Copying package...'
    4.95 +	action 'Copying package...'
    4.96  	cp "$PACKAGE_FILE" "$TMP_DIR"
    4.97 -	qstatus
    4.98 +	status
    4.99  
   4.100  	cd "$TMP_DIR"
   4.101  	extract_package "$(basename "$PACKAGE_FILE")"
   4.102 @@ -373,7 +373,7 @@
   4.103  
   4.104  
   4.105  	# Remember modified packages
   4.106 -	qaction 'Remember modified packages...'
   4.107 +	action 'Remember modified packages...'
   4.108  	{
   4.109  		check=false
   4.110  		# TODO: why '[' the special?
   4.111 @@ -419,7 +419,7 @@
   4.112  		fi
   4.113  		echo "$PACKAGE" >> "$dir/modifiers"
   4.114  	done
   4.115 -	qstatus
   4.116 +	status
   4.117  
   4.118  
   4.119  	cd "$TMP_DIR"
   4.120 @@ -435,7 +435,7 @@
   4.121  
   4.122  	if [ -n "$CONFIG_FILES" ]; then
   4.123  		# Save "official" configuration files
   4.124 -		qaction 'Saving configuration files...'
   4.125 +		action 'Saving configuration files...'
   4.126  		debug "\n"
   4.127  
   4.128  		cd fs
   4.129 @@ -461,12 +461,12 @@
   4.130  			done
   4.131  		fi
   4.132  		# always '[ Done ]' status, unless '--newconf' is passed or not
   4.133 -		:; qstatus
   4.134 +		:; status
   4.135  	fi
   4.136  
   4.137  
   4.138  	if [ -n "$(ls fs/* 2>/dev/null)" ]; then
   4.139 -		qaction 'Installing package...'
   4.140 +		action 'Installing package...'
   4.141  
   4.142  		debug '\n  resolving destination links in source'
   4.143  		IFS=$'\n'
   4.144 @@ -481,12 +481,12 @@
   4.145  
   4.146  		debug '  copying folders and files to destination'
   4.147  		cp -af fs/* "$root/"
   4.148 -		qstatus
   4.149 +		status
   4.150  	fi
   4.151  
   4.152  
   4.153  	if [ -s files2remove.list ]; then
   4.154 -		qaction 'Removing old files...'
   4.155 +		action 'Removing old files...'
   4.156  		while read file; do
   4.157  			dir="$root$file"
   4.158  			# Remove specified file
   4.159 @@ -497,14 +497,14 @@
   4.160  				rmdir "$dir" 2>/dev/null || break
   4.161  			done
   4.162  		done < files2remove.list
   4.163 -		:; qstatus
   4.164 +		:; status
   4.165  	fi
   4.166  
   4.167  
   4.168  	# Remove the temporary random directory.
   4.169 -	qaction "Removing all tmp files..."
   4.170 +	action "Removing all tmp files..."
   4.171  	cd ..; rm -rf "$TMP_DIR"
   4.172 -	qstatus
   4.173 +	status
   4.174  
   4.175  
   4.176  	# Post install commands
   4.177 @@ -527,7 +527,7 @@
   4.178  	fgrep -q /lib/modules "$fl" && ukrnl='yes'
   4.179  
   4.180  	if [ -n "$udesk$umime$uicon$uschm$upixb$ukrnl" ]; then
   4.181 -		qaction 'Update system databases...'
   4.182 +		action 'Update system databases...'
   4.183  		upd=1
   4.184  	fi
   4.185  
   4.186 @@ -544,7 +544,7 @@
   4.187  	# packages 'busybox', 'kmod', 'depmod'
   4.188  	[ -n "$ukrnl" ] && grep '/lib/modules' "$fl" | cut -d'/' -f4 | uniq | xargs chroot "$root/" /sbin/depmod -a
   4.189  
   4.190 -	[ "$upd" -eq 1 ] && qstatus
   4.191 +	[ "$upd" -eq 1 ] && status
   4.192  
   4.193  
   4.194  
   4.195 @@ -565,7 +565,7 @@
   4.196  	sort "$ii" > "$TEMP_FILE"; mv -f "$TEMP_FILE" "$ii"; chmod a+r "$ii"; unset ii
   4.197  
   4.198  	cd "$CUR_DIR"
   4.199 -	qfooter "$(_ 'Package "%s" (%s) is installed.' "$PACKAGE" "$VERSION$EXTRAVERSION")"
   4.200 +	footer "$(_ 'Package "%s" (%s) is installed.' "$PACKAGE" "$VERSION$EXTRAVERSION")"
   4.201  
   4.202  	# Log this activity
   4.203  	log_pkg Installed