small patch for poudriere jail (fwd)

Dmitry Morozovsky marck at rinet.ru
Fri Jan 10 13:05:18 UTC 2014


Bapt, colleagues,

forward this to the public list so patch will be searchable.

Thanks!

-- 
Sincerely,
D.Marck                                     [DM5020, MCK-RIPE, DM3-RIPN]
[ FreeBSD committer:                                 marck at FreeBSD.org ]
------------------------------------------------------------------------
*** Dmitry Morozovsky --- D.Marck --- Wild Woozle --- marck at rinet.ru ***
------------------------------------------------------------------------

---------- Forwarded message ----------
Date: Sat, 4 Jan 2014 17:38:58
From: Dmitry Morozovsky <marck at rinet.ru>
To: bapt at FreeBSD.org
Subject: small patch for poudriere jail

Dear Baptiste,

first of all, Happy New Year, and have a very nice holidays!

I wish to propose small patch for poudriere list command, allowing automating 
of jail rebuild in a form like

apply 'poudriere jail -u -j' `poudriere jail -l -q -n`

Here is sample output

root at hamster:/usr/ports# poudriere jail -l -n -q
92amd64
9i386
9amd64
91amd64
root at hamster:/usr/ports# poudriere jail -l -q
92amd64              9.2-RELEASE-p2 r258725 amd64   svn     /usr/local/poudriere/jails/92amd64
9i386                9.2-STABLE r260136   i386    svn     /usr/local/poudriere/jails/9i386
9amd64               9.2-STABLE r260136   amd64   svn     /usr/local/poudriere/jails/9amd64
91amd64              9.1-RELEASE-p9 r258725 amd64   svn    /usr/local/poudriere/jails/91amd64

BTW, it seems 'n:' had been left in option string from earlier ages :)

-- 
Sincerely,
D.Marck                                     [DM5020, MCK-RIPE, DM3-RIPN]
[ FreeBSD committer:                                 marck at FreeBSD.org ]
------------------------------------------------------------------------
*** Dmitry Morozovsky --- D.Marck --- Wild Woozle --- marck at rinet.ru ***
------------------------------------------------------------------------
-------------- next part --------------
--- jail.sh.orig	2014-01-04 17:26:10.126255294 +0400
+++ jail.sh	2014-01-04 17:33:28.549255290 +0400
@@ -39,6 +39,7 @@
 
 Options:
     -q            -- Quiet (Do not print the header)
+    -n            -- Print only jail name
     -J n          -- Run buildworld in parallel with n jobs.
     -j jailname   -- Specify the jailname
     -v version    -- Specify which version of FreeBSD to install in the jail.
@@ -76,12 +77,16 @@
 		printf "${format}" "JAILNAME" "VERSION" "ARCH" "METHOD" "PATH"
 	[ -d ${POUDRIERED}/jails ] || return 0
 	for j in $(find ${POUDRIERED}/jails -type d -maxdepth 1 -mindepth 1 -print); do
-		name=${j##*/}
+	    name=${j##*/}
+	    if [ ${NAMEONLY} -eq 0 ]; then
 		version=$(jget ${name} version)
 		arch=$(jget ${name} arch)
 		method=$(jget ${name} method)
 		mnt=$(jget ${name} mnt)
 		printf "${format}" "${name}" "${version}" "${arch}" "${method}" "${mnt}"
+	    else
+		echo "${name}"
+	    fi
 	done
 }
 
@@ -548,6 +553,7 @@
 DELETE=0
 CREATE=0
 QUIET=0
+NAMEONLY=0
 INFO=0
 UPDATE=0
 PTNAME=default
@@ -559,7 +565,7 @@
 
 TMPFS_ALL=0
 
-while getopts "J:j:v:a:z:m:n:f:M:sdklqcip:ut:z:P:" FLAG; do
+while getopts "J:j:v:a:z:m:nf:M:sdklqcip:ut:z:P:" FLAG; do
 	case "${FLAG}" in
 		j)
 			JAILNAME=${OPTARG}
@@ -607,6 +613,9 @@
 		d)
 			DELETE=1
 			;;
+		n)
+			NAMEONLY=1
+			;;
 		p)
 			PTNAME=${OPTARG}
 			;;


More information about the freebsd-pkg mailing list