[csw-users] pkg-get -u automation?

Thomas Glanzmann sithglan at stud.uni-erlangen.de
Fri Jun 11 22:14:07 CEST 2004


Hallo,

> Hi, I set the /var/sadm/install/admin/default to automated installs, etc. 
> but is there a way to automate upgrades so that you don't have to hit y 
> for each package to be upgraded?

        /usr/bin/pkg-get -f -u
        /usr/bin/pkg-get -f -u

	echo "Getting uninstalled packages..."
	CSW_UNINSTALLED=(`/usr/bin/pkg-get -c | /usr/bin/awk -e '{if ( $2 == "[Not" && $3 == "installed]" ) print $1; }'`)

	echo "Installing new packages"
	CSW_INDEX=0
	(while read selections; do
		FOUND=0
		for CSW_AVAILABLE in "${CSW_UNINSTALLED[@]}"; do
			if [ "${CSW_AVAILABLE}" = "${selections}" ]; then
				echo
				/usr/bin/pkg-get -f install "${selections}"
				FOUND=1
			fi
		done
		if [ "${FOUND}" = "0" ]; then
			echo -n "."
		fi
	done) </var/cfengine/inputs/csw-selections
	echo

we use the above script. This requires bash 2.x and was written by
Michael Gernoth.

	Thomas



More information about the users mailing list