Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Update pbi-manager10

* Allow using "short-names" for pbi_info / pbi_delete / pbi_update, this
  lets us do something like "pbi_info nginx" and it'll match the first nginx
  it finds

* Add PBI_LICENSE / PBI_TAGS / PBI_SHORTDESC / PBI_DESC as optional
  variables we can set in pbi.conf. LIC / DESC / SHORTDESC will be pulled
  from a port automatically

* When we create a PBI using a module / confdir, we will include the confdir
  in the PBI directory under /usr/pbi/<pbidir>/pbiconf. This will allow
  easy re-creation of a PBI from the port/packages
  • Loading branch information...
commit 8bea84f26fe4676742242ed613beba462e807282 1 parent b5dbe14
@kmoore134 kmoore134 authored
Showing with 108 additions and 14 deletions.
  1. +108 −14 src-sh/pbi-manager10/pbi-manager
View
122 src-sh/pbi-manager10/pbi-manager
@@ -373,9 +373,14 @@ parse_delete_pbi_cmdline() {
;;
*) if [ $# -gt 1 ]; then usage_delete_pbi; fi
if [ ! -e "${PBI_DBAPPDIR}/${1}" ] ; then
- exit_err "can't find installed pbi (${1})"
+ find_pbi_namematch "$1"
+ if [ -z "$PBI_NAMEMATCH" ] ; then
+ exit_err "can't find installed pbi (${1})"
+ fi
+ PBI_DELETENAME="$PBI_NAMEMATCH"
+ else
+ PBI_DELETENAME="$1"
fi
- PBI_DELETENAME="$1"
;;
esac
shift
@@ -383,6 +388,19 @@ parse_delete_pbi_cmdline() {
if [ -z "${PBI_DELETENAME}" ];then usage_delete_pbi; fi
}
+find_pbi_namematch()
+{
+ PBI_NAMEMATCH=""
+ for i in `ls -d ${PBI_DBAPPDIR}/* 2>/dev/null`
+ do
+ if [ ! -e "$i/pbi_name" ] ; then continue ; fi
+ if [ "`cat $i/pbi_name`" = "$1" ] ; then
+ PBI_NAMEMATCH="`basename ${i}`"
+ break
+ fi
+ done
+}
+
# Parse the command line for icon
parse_icon_pbi_cmdline() {
while [ $# -gt 0 ]; do
@@ -398,9 +416,14 @@ parse_icon_pbi_cmdline() {
*)
if [ $# -gt 1 ]; then usage_icon_pbi; fi
if [ ! -e "${PBI_DBAPPDIR}/${1}" ] ; then
- exit_err "can't find installed pbi (${1})"
+ find_pbi_namematch "$1"
+ if [ -z "$PBI_NAMEMATCH" ] ; then
+ exit_err "can't find installed pbi (${1})"
+ fi
+ PBI_ICONTARGETAPP="${PBI_NAMEMATCH}"
+ else
+ PBI_ICONTARGETAPP="$1"
fi
- PBI_ICONTARGETAPP="$1"
;;
esac
shift
@@ -443,9 +466,14 @@ parse_info_pbi_cmdline() {
*)
if [ $# -gt 1 ]; then usage_info_pbi; fi
if [ ! -e "${PBI_DBAPPDIR}/${1}" ] ; then
- exit_err "can't find installed pbi (${1})"
+ find_pbi_namematch "$1"
+ if [ -z "$PBI_NAMEMATCH" ] ; then
+ exit_err "can't find installed pbi (${1})"
+ fi
+ PBI_INFONAME="$PBI_NAMEMATCH"
+ else
+ PBI_INFONAME="$1"
fi
- PBI_INFONAME="$1"
;;
esac
shift
@@ -1096,10 +1124,16 @@ parse_create_pbi_cmdline() {
if [ $# -gt 1 ]; then usage_create_pbi; fi
if [ "$PBI_CBACKUP" = "YES" ] ; then
if [ ! -e "${PBI_DBAPPDIR}/${1}" ] ; then
- exit_err "can't find installed pbi (${1})"
+ find_pbi_namematch "$1"
+ if [ -z "$PBI_NAMEMATCH" ] ; then
+ exit_err "can't find installed pbi (${1})"
+ fi
+ PBI_CBACKUPTARGET="${PBI_NAMEMATCH}"
+ PBI_PROGDIRPATH="${PBI_NAMEMATCH}"
+ else
+ PBI_CBACKUPTARGET="${1}"
+ PBI_PROGDIRPATH="${1}"
fi
- PBI_CBACKUPTARGET="${1}"
- PBI_PROGDIRPATH="${1}"
else
get_abspath "$1"
PBI_PROGDIRPATH="$_ABSPATH"
@@ -1249,9 +1283,14 @@ parse_update_pbi_cmdline() {
*) if [ $# -gt 1 ]; then usage_update_pbi; fi
if [ -n "$PBI_UPDATEAPP" ] ; then usage_update_pbi ; fi
if [ ! -e "${PBI_DBAPPDIR}/${1}" ] ; then
- exit_err "can't find installed pbi (${1})"
+ find_pbi_namematch "$1"
+ if [ -z "$PBI_NAMEMATCH" ] ; then
+ exit_err "can't find installed pbi (${1})"
+ fi
+ PBI_UPDATEAPP="$PBI_NAMEMATCH"
+ else
+ PBI_UPDATEAPP="$1"
fi
- PBI_UPDATEAPP="$1"
;;
esac
shift
@@ -2831,6 +2870,10 @@ pbi_display_info() {
*) echo "Signature: <Unknown>" ;;
esac
+ if [ -n "$PBI_LICENSE" ] ; then
+ echo "License: $PBI_LICENSE"
+ fi
+
if [ -n "${PBI_REPO}" ] ; then
local _rDesc="`cat ${PBI_DBREPODIR}/*.${PBI_REPO} | grep "Desc:" | sed 's|Desc: ||g'`"
local _rID="`ls ${PBI_DBREPODIR}/*.${PBI_REPO}`"
@@ -3000,6 +3043,10 @@ load_info_from_dir() {
PBI_REPO=""
PBI_REQUIRESROOT=""
PBI_SIGVALID=""
+ PBI_DESC=""
+ PBI_SHORTDESC=""
+ PBI_TAGS=""
+ PBI_LICENSE=""
PBI_ORIGPROGDIRPATH="`cat ${1}/pbi_defaultpath`"
PBI_PROGNAME="`cat ${1}/pbi_name`"
@@ -3013,6 +3060,19 @@ load_info_from_dir() {
PBI_ARCHIVE_COUNT="`cat ${1}/pbi_archivecount 2>/dev/null`"
PBI_ARCHIVE_CHECKSUM="`cat ${1}/pbi_archivesum 2>/dev/null`"
+ if [ -e "${1}/pbi_license" ] ; then
+ PBI_LICENSE="`cat ${1}/pbi_license`"
+ fi
+ if [ -e "${1}/pbi_tags" ] ; then
+ PBI_TAGS="`cat ${1}/pbi_tags`"
+ fi
+ if [ -e "${1}/pbi_desc" ] ; then
+ PBI_DESC="`cat ${1}/pbi_desc`"
+ fi
+ if [ -e "${1}/pbi_shortdesc" ] ; then
+ PBI_SHORTDESC="`cat ${1}/pbi_shortdesc`"
+ fi
+
# Check if auto-update is enabled
if [ -e "${1}/autoupdate-enable" ] ; then
PBI_ENABLEAUTOUPDATE="YES"
@@ -4069,6 +4129,9 @@ mk_stage_dir() {
mkdir -p ${PBI_STAGEDIR}/linux
mkdir -p ${PBI_STAGEDIR}/run
+ # If we built with a module / conf directory, lets include it
+ if [ -d "${PBI_CONFDIR}" ] ; then cp -r ${PBI_CONFDIR} ${PBI_STAGEDIR}/pbiconf; fi
+
local _excOpts=""
# Build module list of excludes
@@ -4225,6 +4288,20 @@ save_pbi_details_to_header() {
cp "$PBI_CREATE_USERMETA" "${PBI_HEADERDIR}/${PBI_USERMETAFILE}"
fi
+ # Check for additional meta-data
+ if [ -n "$PBI_LICENSE" ] ; then
+ echo "$PBI_LICENSE" > ${PBI_HEADERDIR}/pbi_license
+ fi
+ if [ -n "$PBI_TAGS" ] ; then
+ echo "$PBI_TAGS" > ${PBI_HEADERDIR}/pbi_tags
+ fi
+ if [ -n "$PBI_DESC" ] ; then
+ echo "$PBI_DESC" > ${PBI_HEADERDIR}/pbi_desc
+ fi
+ if [ -n "$PBI_SHORTDESC" ] ; then
+ echo "$PBI_SHORTDESC" > ${PBI_HEADERDIR}/pbi_shortdesc
+ fi
+
# Custom install / remove scripts
if [ -e "${PBI_CONFDIR}/${PBI_CONF_SCRIPTSDIR}/${MOD_PREINS}" ] ; then
cp "${PBI_CONFDIR}/${PBI_CONF_SCRIPTSDIR}/${MOD_PREINS}" \
@@ -6734,12 +6811,12 @@ do_pbi_make() {
# Auto-generate a external_links directive from plist info
mk_auto_ext_linksfile
- # Check if we created a linux app, and need to copy files for it
- #auto_copy_linuxbase
-
# Break here if we are only doing a build
if [ "${PBI_BUILDONLY}" = "YES" ] ; then exit_trap; fi
+ # Load any extra meta-data from the package
+ load_pkg_metadata
+
# Start creation of PBI
do_pbi_create
@@ -6750,6 +6827,23 @@ do_pbi_make() {
exit 0
}
+# Loads some optional meta-data from the package
+load_pkg_metadata()
+{
+ if [ -z "$PBI_LICENSE" ] ; then
+ PBI_LICENSE="`pkg query '%L' ${PBI_MAKEPORT}`"
+ fi
+ if [ -z "$PBI_SHORTDESC" ] ; then
+ PBI_SHORTDESC="`pkg query '%c' ${PBI_MAKEPORT}`"
+ fi
+ if [ -z "$PBI_DESC" ] ; then
+ PBI_DESC="`pkg query '%e' ${PBI_MAKEPORT}`"
+ fi
+ if [ -z "$PBI_PROGWEB" ] ; then
+ PBI_PROGWEB="`pkg query '%w' ${PBI_MAKEPORT}`"
+ fi
+}
+
# Check if we need to save a list of GROUPS to create at install
mk_pbi_groups_file()
{
Please sign in to comment.
Something went wrong with that request. Please try again.