- if [ -f "$path" ]; then
-
- hash=$(./zpm-addfile $pkgfile $path)
-
-#if [ -z "$hash" ]; then continue; fi
-
-# TODO mtime, mode
-sqlite3 $pkgfile <<EOS
-PRAGMA foreign_keys = ON;
-insert or replace into packagefiles (package,version,release,path,mode,mtime,username,groupname,hash)
-values ('$package', '$pkgver', $pkgrel, '$rpath', '$mode',$mtime, '$username','$groupname','$hash')
-;
-EOS
-elif [ -d "$path" ]; then
-sqlite3 $pkgfile <<EOS
-PRAGMA foreign_keys = ON;
-insert or replace into packagefiles (package,version,release,path,mode,mtime,username,groupname)
-values ('$package', '$pkgver', $pkgrel, '$rpath', '$mode',$mtime, '$username','$groupname')
-;
-EOS
-elif [ -l "$path" ]; then
- target=$(readlink $path)
-sqlite3 $pkgfile <<EOS
-PRAGMA foreign_keys = ON;
-insert or replace into packagefiles (package,version,release,path,mode,mtime,username,groupname,target)
-values ('$package', '$pkgver', $pkgrel, '$rpath', '$mode',$mtime, '$username','$groupname','$target')
-;
-EOS
-fi
-#printf "%s %s%s\n" $path $rpath ${target:+" -> $target"}
-printf "%s\n" $path
+ if [ $? -ne 0 ]; then
+ die 'zpm-syncfs failed';
+ fi
+
+ if [ $runscripts -gt 0 ]; then
+ zpm runscript -f $pkgfile -p post-install $pkgid $current
+ fi
+
+ if [ -n "$current" ]; then
+ zpm pkg $pkgid status=installed :$current status=updated
+ else
+ zpm pkg $pkgid status=installed
+ fi
+
+ if [ $(id -u) -eq 0 ]; then
+ if [ -f $rootdir/sbin/ldconfig ]; then
+ $rootdir/sbin/ldconfig -r ${rootdir:-/}
+ elif [ -f /sbin/ldconfig ]; then
+ /sbin/ldconfig -r ${rootdir:-/}
+ else
+ true
+ fi
+ fi
+
+ # TODO skip configure if not on a terminal, regardless of settings
+ # TODO will need force option
+ if [ $runconfigure -gt 0 ]; then
+ zpm runscript -f $pkgfile -p configure $pkgid $current
+ fi