[PC-BSD Commits] r7589 - in pcbsd/current/src-qt4/pbi-manager: . man
svn at pcbsd.org
svn at pcbsd.org
Fri Sep 17 08:52:42 PDT 2010
Author: kris
Date: 2010-09-17 08:52:42 -0700 (Fri, 17 Sep 2010)
New Revision: 7589
Modified:
pcbsd/current/src-qt4/pbi-manager/man/pbi_create.1
pcbsd/current/src-qt4/pbi-manager/pbi-manager
Log:
Added '-b' option to pbi_create, which lets you make a backup PBI from a currently installed
PBI. Useful when you want to re-package the PBI for installing on another system, or just to
keep a backup copy when you've deleted the original.
The new copy will *not* be digitally signed, unless you provide new keys to sign it with
Modified: pcbsd/current/src-qt4/pbi-manager/man/pbi_create.1
===================================================================
--- pcbsd/current/src-qt4/pbi-manager/man/pbi_create.1 2010-09-17 15:11:23 UTC (rev 7588)
+++ pcbsd/current/src-qt4/pbi-manager/man/pbi_create.1 2010-09-17 15:52:42 UTC (rev 7589)
@@ -7,6 +7,7 @@
.Sh SYNOPSIS
.Nm
.Op Fl a Ar author
+.Op Fl b
.Op Fl c Ar confdir
.Op Fl d Ar portsdir
.Op Fl i Ar icon
@@ -29,6 +30,9 @@
.Bl -tag -width indent
.It Fl a Ar author
Specify the Author for this PBI
+.It Fl b
+Make a backup of an installed PBI, when using this option specify the
+target PBI name instead of [pbidir]
.It Fl c Ar confdir
Specify the meta-data confdir to use. While not required for building
a PBI, it is highly recommended. Without some configuration settings
Modified: pcbsd/current/src-qt4/pbi-manager/pbi-manager
===================================================================
--- pcbsd/current/src-qt4/pbi-manager/pbi-manager 2010-09-17 15:11:23 UTC (rev 7588)
+++ pcbsd/current/src-qt4/pbi-manager/pbi-manager 2010-09-17 15:52:42 UTC (rev 7589)
@@ -72,6 +72,7 @@
Options:
-a author -- Application Author
+ -b -- Make a backup of an already installed PBI
-c confdir -- PBI configuration meta-data directory
-d portdir -- Use different ports dir (Default: /usr/ports)
-i icon -- Application Icon, relative to pbidir/
@@ -477,6 +478,8 @@
-a) if [ $# -eq 1 ]; then usage_create_pbi; fi
shift; PBI_CAUTHOR="$1"
;;
+ -b) PBI_CBACKUP="YES"
+ ;;
-c) if [ $# -eq 1 ]; then usage_create_pbi; fi
shift;
get_abspath "$1"
@@ -512,11 +515,19 @@
;;
*)
if [ $# -gt 1 ]; then usage_create_pbi; fi
- get_abspath "$1"
- PBI_PROGDIRPATH="$_ABSPATH"
- if [ ! -d "${PBI_PROGDIRPATH}" ] ; then
- exit_err "Invalid pbidir (${1})"
- fi
+ if [ "$PBI_CBACKUP" = "YES" ] ; then
+ if [ ! -e "${PBI_DBDIR}/${1}" ] ; then
+ exit_err "can't find installed pbi (${1})"
+ fi
+ PBI_CBACKUPTARGET="${1}"
+ PBI_PROGDIRPATH="${1}"
+ else
+ get_abspath "$1"
+ PBI_PROGDIRPATH="$_ABSPATH"
+ if [ ! -d "${PBI_PROGDIRPATH}" ] ; then
+ exit_err "Invalid pbidir (${1})"
+ fi
+ fi
;;
esac
shift
@@ -733,6 +744,8 @@
PBI_AB_PRUNE=""
PBI_BUILDONLY="NO"
PBI_CAUTHOR=""
+ PBI_CBACKUP=""
+ PBI_CBACKUPTARGET=""
PBI_CHECKSCRIPTS=""
PBI_CICON=""
PBI_CNAME=""
@@ -1764,6 +1777,13 @@
parse_create_pbi_cmdline "$@"
+ # If we are making a backup copy of an installed PBI
+ if [ "$PBI_CBACKUP" = "YES" ] ; then
+ init_tmpdir
+ do_pbi_create_backup
+ exit_trap
+ fi
+
load_pbi_conffile
parse_cmdline_overrides
@@ -1773,6 +1793,45 @@
do_pbi_create
}
+# Start the pbi_create backup process
+do_pbi_create_backup() {
+
+ load_info_from_dir "${PBI_DBDIR}/${PBI_CBACKUPTARGET}"
+ echo "Creating backup PBI: ${PBI_PROGNAME}-${PBI_PROGVERSION}"
+
+ # Start by making a fresh archive of the installed PBI
+ PBI_STAGEDIR="$PBI_ORIGPROGDIRPATH"
+ mk_archive_file
+
+ # Now make the header dir
+ _hDir="${PBI_TMPDIR}/.header.$$"
+ PBI_HEADERDIR="${_hDir}"
+ mkdir -p "${_hDir}"
+ cp ${PBI_DBDIR}/${PBI_CBACKUPTARGET}/* "${_hDir}"
+ rm ${_hDir}/*.sha1 >/dev/null 2>/dev/null
+
+ # Get the total number of files in the STAGEDIR
+ get_filetotal_dir "${PBI_STAGEDIR}"
+ echo "${FILETOTAL}" > "${PBI_HEADERDIR}/pbi_archivecount"
+
+ # Save a checksum of archive file
+ sha256 -q "${PBI_CREATE_ARCHIVE}" > "${PBI_HEADERDIR}/pbi_archivesum"
+
+ # Sign any header files
+ sign_pbi_files "$PBI_HEADERDIR"
+
+ # Make the header archive
+ mk_header_file
+
+ # Remove the new headerdir
+ rm -rf "$PBI_HEADERDIR"
+
+ # Now finish up and make the resulting PBI file
+ mk_output_pbi
+
+}
+
+
# Vars required for creation
check_create_required_vars() {
if [ -z "${PBI_PROGNAME}" ] ; then exit_err "Missing PBI_PROGNAME"; fi
More information about the Commits
mailing list