Hmm ... ok das habe ich nicht geschafft. Ich muss also jetzt die Abfrage in das Shell-Skript reinnehmen, aber dafür funktioniert mein Skript jetzt.
Mit nur einem Shell-Aufruf kann ich jetzt die Pakete installieren, die ich auf allen Rechnern installiert haben möchte. Bei nochmaligem Aufruf werden nur die Updates installiert.
Wenn es jemanden interessiert:
Code:
#!/bin/bash
# install packages
# get version with pkgutil --pkg-info com.growl.growl.pkg
echo "=== installing packages ==="
install_pkg() {
string=`pkgutil --pkg-info "$1"`
string=${string#*'version: '*}
string=${string%*'volume:'*}
string=`echo "$string" | tr -cd "[:print:]"`
[ $string ] || string="XXX"
if [ "$string" != "$2" ]; then
echo "Install $1 ($3)? (y/n)"
read -s -n 1
[ "$REPLY" = "y" ] && sudo installer -pkg $3 -target LocalSystem
fi
}
install_pkg "com.growl.growl.pkg" "1.2" "Growl.pkg"
install_pkg "com.Logitech.Control Center.pkg" "3.0.0" "LogitechControlCenter.mpkg"
install_pkg "com.google.macfuse" "2.0" "MacFUSE.pkg"
install_pkg "org.catacombae.ntfs-3g_package" "2009.4.4" "MacFUSE_NTFS3G.mpkg"
install_pkg "net.culater.simbl.SIMBL.pkg" "9" "SIMBL.pkg"
install_pkg "com.sweetpproductions.SafariCookies.pkg" "1.3" "Safari_Cookies.pkg"
install_pkg "org.TrueCryptFoundation.TrueCrypt" "6.3" "TrueCrypt.mpkg"
install_pkg "tuntap.tap" "1" "tuntap.pkg"
echo "=== installing files to /Library ==="
sudo rsync -rulv Library /
echo "=== package installation complete ==="