[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [ezjail] patch: ezjail-admin install -S/-M bug fix



Panagiotis Christias wrote:
Dirk Engling wrote:
On 31.03.10 08:21, Panagiotis Christias wrote:

unless I am doing something wrong it looks like the -S and -M options in
"ezjail-admin install" fail to work properly. See attached patch.

I think that ezjail-admin:943 does the trick:

for pkg in ${ezjail_basesystem} ${ezjail_installmanpages} ${ezjail_installsources}; do

doesn't it? I currently can't verify it, since I'm still in South America and only back on 15th.

Will fetch and extract/install under $ezjail_jailfull but the subsequent ezjail_splitworld will not run if $ezjail_basesystem is not defined. Also the ZFS parts of ezjail_splitworld make the assumption that base also gets installed during the procedure which is not true when using -M or -S. Finally, sources, if installed separately, require an extra 'mkdir -p $ezjail_jailfull/usr/src'.

Updated version, -S and -M can be used together and $ezjail_jailfull is properly removed after finishing with -S/-M/-P.

Regards,
Panagiotis

--
Panagiotis J. Christias    Network Management Center
p.christias AT noc.ntua DOT gr    National Technical Univ. of Athens, GREECE
--- ezjail-admin.orig	2010-03-17 12:16:20.000000000 +0200
+++ ezjail-admin	2010-04-01 19:50:09.000000000 +0300
@@ -301,6 +301,24 @@
   [ "${ezjail_uglyperlhack}" -a ! -L "${ezjail_jailbase}/usr/bin/perl" ] && ln -s /usr/local/bin/perl "${ezjail_jailbase}/usr/bin/perl"
 }
 
+# install sources only - this function is used by install and update
+ezjail_installsources() {
+  cd "${ezjail_jailfull}" || exerr "Error: Cant access temporary Jail directory."
+  find usr/src | cpio -d -p -v "${ezjail_jailbase}" || exerr "Error: Installation of sources failed."
+  cd ${ezjail_jaildir}
+  chflags -R noschg "${ezjail_jailfull}"
+  rm -r "${ezjail_jailfull}/src"
+}
+
+# install manpages only - this function is used by install and update
+ezjail_installmanpages() {
+  cd "${ezjail_jailfull}" || exerr "Error: Cant access temporary Jail directory."
+  find usr/share/man | cpio -d -p -v "${ezjail_jailbase}" || exerr "Error: Installation of manpages failed."
+  cd ${ezjail_jaildir}
+  chflags -R noschg "${ezjail_jailfull}"
+  rm -r "${ezjail_jailfull}/share"
+}
+
 # The user may want to have a ports tree in basejail
 ezjail_updateports () {
   local _portsnap_fetch="fetch"
@@ -962,6 +980,7 @@
       # of sources to install, base asks the user if he is sure, hence the
       # yes and the set -- all
       [ "${pkg}" = "base" ] && echo "Ignore the next question, ezjail answers it for you."
+      [ "${pkg}" = "src" ] && mkdir -p "${ezjail_jailfull}/usr/src"
       set -- all
       [ -f install.sh ] && yes | . install.sh
       [ $? -eq 0 ] || exerr "Error: Package install script for ${pkg} failed."
@@ -978,9 +997,18 @@
   # Split basejail and newjail
   [ "${ezjail_basesystem}" ] && ezjail_splitworld
 
+  # Fill just sources, if requested
+  [ "${ezjail_installsources}" -a ! "${ezjail_basesystem}" ] && ezjail_installsources
+
+  # Fill just manpages, if requested
+  [ "${ezjail_installmanpages}" -a ! "${ezjail_basesystem}" ] && ezjail_installmanpages
+
   # Fill ports, if requested
   [ "${ezjail_installports}" ] && ezjail_updateports
 
+  # Clean up
+  [ ! "${ezjail_basesystem}" ] && rm -r "${ezjail_jailfull}"
+
   ;;
 ######################## ezjail-admin SHORTCUT ########################
 *start|*stop|*startcrypto|*stopcrypto)