+if [ -n "$rootdir" ]; then
+ : rootdir=${rootdir%%/}
+fi
+
+if [ -z "$localdb" ]; then
+ localdb=${rootdir}/var/lib/zpm/local.db
+fi
+
+if [ ! -f "$localdb" ]; then
+ if [ -n "$rootdir" ] && [ ! -d $rootdir ]; then
+ mkdir $rootdir || die "can't create $rootdir: $!"
+ fi
+ for d in /var /var/lib /var/lib/zpm; do
+ test -d $rootdir/$d || mkdir $rootdir/$d || die "can't create $rootdir/$d/: $!"
+ done
+ zpm init "$localdb"
+ if [ $? -ne 0 ]; then
+ die "aborting install"
+ fi
+fi
+