updated make_chroot_jail and iimage 0.9.20
authorMichael Prokop <mika@grml.org>
Sat, 24 Feb 2007 12:16:26 +0000 (13:16 +0100)
committerMichael Prokop <mika@grml.org>
Sat, 24 Feb 2007 12:16:26 +0000 (13:16 +0100)
debian/changelog
usr_bin/iimage
usr_sbin/make_chroot_jail

index 5c101d3..f03e0db 100644 (file)
@@ -1,3 +1,11 @@
+grml-scripts (0.9.20) unstable; urgency=low
+
+  * Updated make_chroot_jail to latest upstream version.
+    Thanks for notification, Wolfgang Fuschlberger!
+  * Updated iimage to latest upstream version (37).
+
+ -- Michael Prokop <mika@grml.org>  Sat, 24 Feb 2007 13:14:40 +0100
+
 grml-scripts (0.9.19) unstable; urgency=low
 
   * Add dirvish-setup, a simple script for setting up a basic
index 14ef84f..77a74ab 100755 (executable)
@@ -49,7 +49,7 @@
 #
 ######################################################################
 
-SVN_ID="$Id: iimage 36 2006-01-14 20:19:46Z ronsc $"
+SVN_ID="$Id: iimage 37 2006-08-22 13:50:17Z ronsc $"
 
 # old templates might still use CVS_VERSION
 CVS_VERSION="$SVN_ID"
@@ -436,7 +436,7 @@ function rotate_image() {
                 | grep Orientation | cut -d":" -f 2  | cut -d"," -f 1 `
    elif [ $JHEAD ]; then
      ORIENTATION=`jhead -v "$FILE" 2>/dev/null \
-                | grep "Orientation =" | cut -d '=' -f 2 | cut -c 2 `
+                | grep "Orientation =" | head -1 | cut -d '=' -f 2 | cut -c 2 `
    fi
    ORIENTATION=`echo $ORIENTATION`
 
index 5ac16c1..30a8b88 100755 (executable)
@@ -14,7 +14,7 @@
 #    ( http://www.fsf.org/licenses/gpl.txt )
 
 # first Release: 2004-07-30
-# latest update: 2007-01-07
+# latest update: 2007-02-24
 #
 # The latest version of the script is available at
 #   http://www.fuschlberger.net/programs/ssh-scp-chroot-jail/
@@ -89,15 +89,15 @@ fi
 
 # Specify the apps you want to copy to the jail
 if [ "$DISTRO" = SUSE ]; then
-  APPS="/bin/bash /bin/cp /usr/bin/dircolors /bin/ls /bin/mkdir /bin/mv /bin/rm /bin/rmdir /bin/sh /bin/su /usr/bin/groups /usr/bin/id /usr/bin/netcat /usr/bin/rsync /usr/bin/ssh /usr/bin/scp /sbin/unix_chkpwd /usr/lib/ssh/sftp-server"
+  APPS="/bin/bash /bin/cp /usr/bin/dircolors /bin/ls /bin/mkdir /bin/mv /bin/rm /bin/rmdir /bin/sh /bin/su /usr/bin/groups /usr/bin/id /usr/bin/netcat /usr/bin/rsync /usr/bin/ssh /usr/bin/scp /sbin/unix_chkpwd"
 elif [ "$DISTRO" = FEDORA ]; then
-  APPS="/bin/bash /bin/cp /usr/bin/dircolors /bin/ls /bin/mkdir /bin/mv /bin/rm /bin/rmdir /bin/sh /bin/su /usr/bin/groups /usr/bin/id /usr/bin/nc /usr/bin/rsync /usr/bin/ssh /usr/bin/scp /sbin/unix_chkpwd /usr/libexec/openssh/sftp-server"
+  APPS="/bin/bash /bin/cp /usr/bin/dircolors /bin/ls /bin/mkdir /bin/mv /bin/rm /bin/rmdir /bin/sh /bin/su /usr/bin/groups /usr/bin/id /usr/bin/nc /usr/bin/rsync /usr/bin/ssh /usr/bin/scp /sbin/unix_chkpwd"
 elif [ "$DISTRO" = REDHAT ]; then
-  APPS="/bin/bash /bin/cp /usr/bin/dircolors /bin/ls /bin/mkdir /bin/mv /bin/rm /bin/rmdir /bin/sh /bin/su /usr/bin/groups /usr/bin/id /usr/bin/nc /usr/bin/rsync /usr/bin/ssh /usr/bin/scp /sbin/unix_chkpwd /usr/libexec/openssh/sftp-server"
+  APPS="/bin/bash /bin/cp /usr/bin/dircolors /bin/ls /bin/mkdir /bin/mv /bin/rm /bin/rmdir /bin/sh /bin/su /usr/bin/groups /usr/bin/id /usr/bin/nc /usr/bin/rsync /usr/bin/ssh /usr/bin/scp /sbin/unix_chkpwd"
 elif [ "$DISTRO" = DEBIAN ]; then
-  APPS="/bin/bash /bin/cp /usr/bin/dircolors /bin/ls /bin/mkdir /bin/mv /bin/rm /bin/rmdir /bin/sh /bin/su /usr/bin/groups /usr/bin/id /usr/bin/rsync /usr/bin/ssh /usr/bin/scp /sbin/unix_chkpwd /usr/lib/sftp-server"
+  APPS="/bin/bash /bin/cp /usr/bin/dircolors /bin/ls /bin/mkdir /bin/mv /bin/rm /bin/rmdir /bin/sh /bin/su /usr/bin/groups /usr/bin/id /usr/bin/rsync /usr/bin/ssh /usr/bin/scp /sbin/unix_chkpwd"
 else
-  APPS="/bin/bash /bin/cp /usr/bin/dircolors /bin/ls /bin/mkdir /bin/mv /bin/rm /bin/rmdir /bin/sh /bin/su /usr/bin/groups /usr/bin/id /usr/bin/rsync /usr/bin/ssh /usr/bin/scp /usr/sbin/unix_chkpwd /usr/lib/misc/sftp-server"
+  APPS="/bin/bash /bin/cp /usr/bin/dircolors /bin/ls /bin/mkdir /bin/mv /bin/rm /bin/rmdir /bin/sh /bin/su /usr/bin/groups /usr/bin/id /usr/bin/rsync /usr/bin/ssh /usr/bin/scp /usr/sbin/unix_chkpwd"
 fi
 
 # Check existence of necessary files
@@ -136,8 +136,7 @@ fi
 
 echo "Checking for dirname..." 
 if [ `which dirname` ]; then
-  echo "  OK
-";
+  echo "  OK";
 else 
   echo "  failed
 
@@ -147,6 +146,40 @@ Please install dirname-binary (to be found eg in the package coreutils)!
 exit 1
 fi
 
+echo "Checking for awk..." 
+if [ `which awk` ]; then
+  echo "  OK
+";
+else 
+  echo "  failed
+
+awk not found!
+Please install (g)awk-package/binary!
+"
+exit 1
+fi
+
+# get location of sftp-server binary from /etc/ssh/sshd_config
+# check for existence of /etc/ssh/sshd_config and for
+# (uncommented) line with sftp-server filename. If neither exists, just skip
+# this step and continue without sftp-server
+#
+if  (test ! -f /etc/ssh/sshd_config &> /dev/null); then
+  echo "
+File /etc/ssh/sshd_config not found.
+Not checking for path to sftp-server.
+  ";
+else
+  if !(grep -v "^#" /etc/ssh/sshd_config | grep -i sftp-server &> /dev/null); then
+    echo "Obviously no sftp-server is running on this system.
+";
+  else SFTP_SERVER=$(grep -v "^#" /etc/ssh/sshd_config | grep -i sftp-server | awk  '{ print $3}')
+  fi
+fi
+
+#if !(grep -v "^#" /etc/ssh/sshd_config | grep -i sftp-server /etc/ssh/sshd_config | awk  '{ print $3}' &> /dev/null); then
+APPS="$APPS $SFTP_SERVER"
+
 # Get accountname to create
 CHROOT_USERNAME=$1
 
@@ -364,13 +397,13 @@ done
 if [ -e ${HOME}/ldlist2 ]; then
     rm ${HOME}/ldlist2
 fi
-for libs in `cat /root/ldlist`; do
+for libs in `cat ${HOME}/ldlist`; do
    frst_char="`echo $libs | cut -c1`"
    if [ "$frst_char" = "/" ]; then
-     echo "$libs" >> /root/ldlist2
+     echo "$libs" >> ${HOME}/ldlist2
    fi
 done
-for lib in `cat /root/ldlist2`; do
+for lib in `cat ${HOME}/ldlist2`; do
     mkdir -p .`dirname $lib` > /dev/null 2>&1
 
        # If the files in the chroot are on the same file system as the original