[PC-BSD Commits] r8008 - pcbsd/current/src-sh/pbi-manager

svn at pcbsd.org svn at pcbsd.org
Tue Nov 9 17:47:30 PST 2010


Author: kris
Date: 2010-11-09 17:47:29 -0800 (Tue, 09 Nov 2010)
New Revision: 8008

Modified:
   pcbsd/current/src-sh/pbi-manager/install.sh
   pcbsd/current/src-sh/pbi-manager/pbi-manager
Log:

Improve /var/db/pbi with new places for keys / installed meta-data / index files



Modified: pcbsd/current/src-sh/pbi-manager/install.sh
===================================================================
--- pcbsd/current/src-sh/pbi-manager/install.sh	2010-11-09 16:28:27 UTC (rev 8007)
+++ pcbsd/current/src-sh/pbi-manager/install.sh	2010-11-10 01:47:29 UTC (rev 8008)
@@ -45,9 +45,9 @@
 cp ${DIR}/icons/default.png ${LB}/share/pbi-manager/icons
 cp ${DIR}/icons/patch.png ${LB}/share/pbi-manager/icons
 
-mkdir -p /var/db/pbi-keys >/dev/null 2>/dev/null
-chmod 644 /var/db/pbi-keys
-cp ${DIR}/keys/*.ssl /var/db/pbi-keys/
+mkdir -p /var/db/pbi/keys >/dev/null 2>/dev/null
+chmod 644 /var/db/pbi/keys
+cp ${DIR}/keys/*.ssl /var/db/pbi/keys/
 
 # Copy the ldconfig script / pbi.conf
 #mkdir -p ${LB}/etc/rc.d >/dev/null 2>/dev/null

Modified: pcbsd/current/src-sh/pbi-manager/pbi-manager
===================================================================
--- pcbsd/current/src-sh/pbi-manager/pbi-manager	2010-11-09 16:28:27 UTC (rev 8007)
+++ pcbsd/current/src-sh/pbi-manager/pbi-manager	2010-11-10 01:47:29 UTC (rev 8008)
@@ -203,7 +203,7 @@
 			exit_trap
 			;;
                  *)     if [ $# -gt 1 ]; then usage_delete_pbi; fi
-			if [ ! -e "${PBI_DBDIR}/${1}" ] ; then
+			if [ ! -e "${PBI_DBAPPDIR}/${1}" ] ; then
                                 exit_err "can't find installed pbi (${1})"
                         fi
                         PBI_DELETENAME="$1"
@@ -226,7 +226,7 @@
                 del-mime)	PBI_MIMEDEL="YES" ;;
                  *)
                         if [ $# -gt 1 ]; then usage_icon_pbi; fi
-			if [ ! -e "${PBI_DBDIR}/${1}" ] ; then
+			if [ ! -e "${PBI_DBAPPDIR}/${1}" ] ; then
                                 exit_err "can't find installed pbi (${1})"
                         fi
                         PBI_ICONTARGETAPP="$1"
@@ -251,7 +251,7 @@
                         ;;
                  *)
                         if [ $# -gt 1 ]; then usage_info_pbi; fi
-			if [ ! -e "${PBI_DBDIR}/${1}" ] ; then
+			if [ ! -e "${PBI_DBAPPDIR}/${1}" ] ; then
                                 exit_err "can't find installed pbi (${1})"
                         fi
                         PBI_INFONAME="$1"
@@ -528,7 +528,7 @@
                  *)
                         if [ $# -gt 1 ]; then usage_create_pbi; fi
 			if [ "$PBI_CBACKUP" = "YES" ] ; then
-				if [ ! -e "${PBI_DBDIR}/${1}" ] ; then
+				if [ ! -e "${PBI_DBAPPDIR}/${1}" ] ; then
                        	        	exit_err "can't find installed pbi (${1})"
                         	fi
 				PBI_CBACKUPTARGET="${1}"
@@ -639,7 +639,7 @@
       --update-all)	PBI_UPDATEAPP="ALL" ;; 
                  *)     if [ $# -gt 1 ]; then usage_update_pbi; fi
 			if [ ! -z "$PBI_UPDATEAPP" ] ; then usage_update_pbi ; fi
-			if [ ! -e "${PBI_DBDIR}/${1}" ] ; then
+			if [ ! -e "${PBI_DBAPPDIR}/${1}" ] ; then
                                 exit_err "can't find installed pbi (${1})"
                         fi
                         PBI_UPDATEAPP="$1"
@@ -662,6 +662,9 @@
 	if [ ! -d "${PBI_APPDIR}" ] ; then mkdir -p ${PBI_APPDIR} >/dev/null 2>/dev/null ; fi
 	if [ ! -d "${PBI_RCDIR}" ] ; then mkdir -p ${PBI_RCDIR} >/dev/null 2>/dev/null ; fi
 	if [ ! -d "${PBI_HASHDIR}" ] ; then mkdir -p ${PBI_HASHDIR} >/dev/null 2>/dev/null ; fi
+	if [ ! -d "${PBI_DBAPPDIR}" ] ; then mkdir -p ${PBI_DBAPPDIR} >/dev/null 2>/dev/null ; fi
+	if [ ! -d "${PBI_DBKEYDIR}" ] ; then mkdir -p ${PBI_DBKEYDIR} >/dev/null 2>/dev/null ; fi
+	if [ ! -d "${PBI_DBINDEXDIR}" ] ; then mkdir -p ${PBI_DBINDEXDIR} >/dev/null 2>/dev/null ; fi
 }
 
 # Get the absolute path of a dir
@@ -778,6 +781,9 @@
 	if [ -z "${PBI_DBDIR}" ] ; then
 		PBI_DBDIR="/var/db/pbi"
 	fi
+	PBI_DBAPPDIR="${PBI_DBDIR}/installed"
+	PBI_DBKEYDIR="${PBI_DBDIR}/keys"
+	PBI_DBINDEXDIR="${PBI_DBDIR}/index"
 	PBI_DISABLEHASHDIR="NO"
 	PBI_GUITOPBANNER="gui_banner.png"
 	PBI_GUISIDEBANNER="gui_sidebanner.png"
@@ -1100,8 +1106,8 @@
 
 	# Update the registered version of the PBI
 	_pbilow="`echo ${PBI_PROGNAME} | tr '[:upper:]' '[:lower:]' | sed 's| ||g'`"
-        oldDir="${PBI_DBDIR}/${_pbilow}-${PBI_PATCHTARGET}-${PBI_APPARCH}"
-        newDir="${PBI_DBDIR}/${_pbilow}-${PBI_PATCHVERSION}-${PBI_APPARCH}"
+        oldDir="${PBI_DBAPPDIR}/${_pbilow}-${PBI_PATCHTARGET}-${PBI_APPARCH}"
+        newDir="${PBI_DBAPPDIR}/${_pbilow}-${PBI_PATCHVERSION}-${PBI_APPARCH}"
 	mv "$oldDir" "$newDir"
 	rm ${newDir}/*.sha1 >/dev/null 2>/dev/null
 	pbi_add_register_app	
@@ -1228,7 +1234,7 @@
 set_patch_wrkdir()
 {
 	_pbilow="`echo ${PBI_PROGNAME} | tr '[:upper:]' '[:lower:]' | sed 's| ||g'`"
-        oldDir="${PBI_DBDIR}/${_pbilow}-${PBI_PATCHTARGET}-${PBI_APPARCH}"
+        oldDir="${PBI_DBAPPDIR}/${_pbilow}-${PBI_PATCHTARGET}-${PBI_APPARCH}"
 
 	if [ ! -e "${oldDir}/pbi_defaultpath" ] ; then
         	exit_err "Can not fild default path for \"$PBI_PROGNAME\"!"
@@ -1249,7 +1255,7 @@
 	
 	# Make sure the target PBI is installed
 	_pbilow="`echo ${PBI_PROGNAME} | tr '[:upper:]' '[:lower:]' | sed 's| ||g'`"
-        oldDir="${PBI_DBDIR}/${_pbilow}-${PBI_PATCHTARGET}-${PBI_APPARCH}"
+        oldDir="${PBI_DBAPPDIR}/${_pbilow}-${PBI_PATCHTARGET}-${PBI_APPARCH}"
 
 	if [ ! -e "${oldDir}" ] ; then
         	exit_err "\"${_pbilow}\" does not appear to be installed!"
@@ -1661,12 +1667,12 @@
 # Return the dbdir for this PBI
 get_dbdir() {
 	tmp="`echo ${PBI_PROGNAME} | tr -d ' ' | tr [A-Z] [a-z]`"
-        APPDBDIR="${PBI_DBDIR}/${tmp}-${PBI_PROGVERSION}-${PBI_APPARCH}"
+        APPDBDIR="${PBI_DBAPPDIR}/${tmp}-${PBI_PROGVERSION}-${PBI_APPARCH}"
 }
 
 # Register this app as installed
 pbi_add_register_app() {
-	if [ ! -d "$PBI_DBDIR" ] ; then mkdir -p ${PBI_DBDIR} ; fi
+	if [ ! -d "$PBI_DBAPPDIR" ] ; then mkdir -p ${PBI_DBAPPDIR} ; fi
         open_header_tmp
 	get_dbdir
 	dir="${APPDBDIR}"
@@ -1851,7 +1857,7 @@
 # Start the pbi_create backup process
 do_pbi_create_backup() {
 
-	load_info_from_dir "${PBI_DBDIR}/${PBI_CBACKUPTARGET}"
+	load_info_from_dir "${PBI_DBAPPDIR}/${PBI_CBACKUPTARGET}"
 	echo "Creating backup PBI: ${PBI_PROGNAME}-${PBI_PROGVERSION}"
 
 	# Start by making a fresh archive of the installed PBI
@@ -1862,7 +1868,7 @@
 	_hDir="${PBI_TMPDIR}/.header.$$"
 	PBI_HEADERDIR="${_hDir}"
 	mkdir -p "${_hDir}"
-	cp ${PBI_DBDIR}/${PBI_CBACKUPTARGET}/* "${_hDir}"
+	cp ${PBI_DBAPPDIR}/${PBI_CBACKUPTARGET}/* "${_hDir}"
 	rm ${_hDir}/*.sha1 >/dev/null 2>/dev/null
 
 	# Get the total number of files in the STAGEDIR
@@ -2555,7 +2561,7 @@
 
 # Delete this PBI
 do_pbi_delete() {
-	load_info_from_dir "${PBI_DBDIR}/${PBI_DELETENAME}"
+	load_info_from_dir "${PBI_DBAPPDIR}/${PBI_DELETENAME}"
 	PBI_PROGDIRPATH="${PBI_ORIGPROGDIRPATH}"
 
 	check_preremove_script
@@ -2676,13 +2682,13 @@
 
 # Remove this PBI registration
 unregister_pbi() {
-	if [ -z "${PBI_DBDIR}" ] ; then return 0 ; fi
+	if [ -z "${PBI_DBAPPDIR}" ] ; then return 0 ; fi
 	if [ -z "${PBI_DELETENAME}" ] ; then return 0 ; fi
-	if [ ! -d "${PBI_DBDIR}/${PBI_DELETENAME}" ] ; then return 0 ; fi
+	if [ ! -d "${PBI_DBAPPDIR}/${PBI_DELETENAME}" ] ; then return 0 ; fi
 	if [ "$PBI_VERBOSE" = "YES" ] ; then
-		echo "Removing: ${PBI_DBDIR}/${PBI_DELETENAME}"
+		echo "Removing: ${PBI_DBAPPDIR}/${PBI_DELETENAME}"
 	fi
-	rm -rf "${PBI_DBDIR}/${PBI_DELETENAME}"
+	rm -rf "${PBI_DBAPPDIR}/${PBI_DELETENAME}"
 
 	# Remove the ldconfig entry
         # KPM - 08172010 - Disable until we get a patch to BSD to support hints via path
@@ -2691,13 +2697,13 @@
 
 # Check if we have a preinstall script we need to use
 check_preremove_script() {
-	if [ ! -e "${PBI_DBDIR}/${PBI_DELETENAME}/${MOD_PREREM}" ] ; then return 0 ; fi
+	if [ ! -e "${PBI_DBAPPDIR}/${PBI_DELETENAME}/${MOD_PREREM}" ] ; then return 0 ; fi
 
 	if [ "$PBI_VERBOSE" = "YES" ] ; then
-		echo "Running pre-removal script: ${PBI_DBDIR}/${PBI_DELETENAME}/${MOD_PREREM}"
+		echo "Running pre-removal script: ${PBI_DBAPPDIR}/${PBI_DELETENAME}/${MOD_PREREM}"
 	fi
         export_script_vars
-       	sh "${PBI_DBDIR}/${PBI_DELETENAME}/${MOD_PREREM}"
+       	sh "${PBI_DBAPPDIR}/${PBI_DELETENAME}/${MOD_PREREM}"
 }
 
 pbi_icon_init() {
@@ -2709,7 +2715,7 @@
 # Start the PBI icon process
 do_pbi_icon() {
 	# Get the dir for this PBI
-	_appDir=`cat ${PBI_DBDIR}/${PBI_ICONTARGETAPP}/pbi_installedpath`
+	_appDir=`cat ${PBI_DBAPPDIR}/${PBI_ICONTARGETAPP}/pbi_installedpath`
 
 	if [ "${PBI_DESKADD}" = "YES" ] ; then
 		if [ ! -e "${_appDir}/.xdg-desktop/${PBI_INS_DESKSCRIPT}" ] ; then 
@@ -2774,13 +2780,13 @@
 	fi
 
 	if [ "$PBI_INFONAME" = "--ALL--" ] ; then
-		for i in `ls ${PBI_DBDIR}/ 2>/dev/null`
+		for i in `ls ${PBI_DBAPPDIR}/ 2>/dev/null`
 		do
-			if [ -e "${PBI_DBDIR}/${i}/pbi_name" ] ; then
+			if [ -e "${PBI_DBAPPDIR}/${i}/pbi_name" ] ; then
 				if [ "$PBI_VERBOSE" = "YES" ] ; then
-        				load_info_from_dir "${PBI_DBDIR}/${i}"
+        				load_info_from_dir "${PBI_DBAPPDIR}/${i}"
 					pbi_display_info
-					pbi_display_gui "${PBI_DBDIR}/${i}" ""
+					pbi_display_gui "${PBI_DBAPPDIR}/${i}" ""
 					echo " "
 				else
 					echo "${i}"
@@ -2789,7 +2795,7 @@
 		done
 	else
 		# Start loading our variables
-        	load_info_from_dir "${PBI_DBDIR}/${PBI_INFONAME}"
+        	load_info_from_dir "${PBI_DBAPPDIR}/${PBI_INFONAME}"
 		pbi_display_info
 	fi
 }
@@ -3003,16 +3009,16 @@
 	check_update_index
 
 	if [ "${PBI_UPCHECK}" = "YES" ] ; then
-		load_info_from_dir "${PBI_DBDIR}/${PBI_UPDATEAPP}"
+		load_info_from_dir "${PBI_DBAPPDIR}/${PBI_UPDATEAPP}"
 		check_pbi_update "$PBI_UPDATEAPP" "display" \
 	 	 "$PBI_PROGNAME" "current" \
 	 	 "$PBI_FBSDVER" "$PBI_APPARCH"
 	else
 		# Loop and check all PBIs for updates
-		for i in `ls ${PBI_DBDIR}/ 2>/dev/null`
+		for i in `ls ${PBI_DBAPPDIR}/ 2>/dev/null`
                 do
-                        if [ -e "${PBI_DBDIR}/${i}/pbi_name" ] ; then
-				load_info_from_dir "${PBI_DBDIR}/${i}"
+                        if [ -e "${PBI_DBAPPDIR}/${i}/pbi_name" ] ; then
+				load_info_from_dir "${PBI_DBAPPDIR}/${i}"
 				check_pbi_update "$i" "display" \
 				 "$PBI_PROGNAME" "current" \
 				 "$PBI_FBSDVER" "$PBI_APPARCH"
@@ -3171,9 +3177,9 @@
 
 	if [ "$PBI_UPDATEAPP" = "ALL" ] ; then
 		# Loop and check all PBIs for updates
-		for i in `ls ${PBI_DBDIR}/ 2>/dev/null`
+		for i in `ls ${PBI_DBAPPDIR}/ 2>/dev/null`
                 do
-                        if [ -e "${PBI_DBDIR}/${i}/pbi_name" ] ; then
+                        if [ -e "${PBI_DBAPPDIR}/${i}/pbi_name" ] ; then
 				PBI_UPDATEAPP="${i}"
 				start_pbi_updateapp "all"
                         fi
@@ -3222,7 +3228,7 @@
 	_upact="${1}"
 
 	# Check for update to this app, and exit or return if not available
-	load_info_from_dir "${PBI_DBDIR}/${PBI_UPDATEAPP}"
+	load_info_from_dir "${PBI_DBAPPDIR}/${PBI_UPDATEAPP}"
 	check_pbi_update "$PBI_UPDATEAPP" "nodisplay" \
 	 "$PBI_PROGNAME" "current" \
 	 "$PBI_FBSDVER" "$PBI_APPARCH"
@@ -4099,7 +4105,7 @@
 load_pbi_etcconf() {
 	if [ ! -e "${PBI_ETCCONF}" ] ; then return 0 ; fi
 	PBI_UPDATEURL="`cat ${PBI_ETCCONF} | grep 'PBI_UPDATEURL: ' | sed 's|PBI_UPDATEURL: ||g'`"
-	PBI_PUBKEYS="`ls /var/db/pbi-keys/*.ssl 2>/dev/null`"
+	PBI_PUBKEYS="`ls ${PBI_DBAPPDIR}/keys/*.ssl 2>/dev/null`"
 
         # Set the default remote mirror we are using
 	PBI_MIRROR="`cat ${PBI_ETCCONF} | grep 'PBI_MIRROR: ' | sed 's|PBI_MIRROR: ||g'`"



More information about the Commits mailing list