Changeset 39e56e7


Ignore:
Timestamp:
07/10/13 07:49:16 (13 months ago)
Author:
Kris Moore <kris@…>
Branches:
master, 9.2-release, releng/10.0, releng/10.0.1, releng/10.0.2
Children:
22f36fc
Parents:
f7f168f
Message:

Update enable_user_pefs to work better with ZFS mounted homedirs

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src-sh/xtrafiles/local/bin/enable_user_pefs

    r9f8fa2c r39e56e7  
    55 
    66PEFSDBDIR="/var/db/pefs" 
    7  
    8 # Check if we can safely enable PEFS on this system 
    9 if [ ! -e "/boot/kernel/pefs.ko" ] ; then 
    10    echo "Error: Requires PEFS in base system!" 
    11    exit 1 
    12 fi 
    137 
    148USER="$1" 
     
    2721 
    2822if [ "$USERHOMEDIR" != "`realpath ${USERHOMEDIR}`" ] ; then 
    29   NEWDIR=`realpath $USERHOMEDIR` 
    30   echo "Updating sym-linked home dir ${USERHOMEDIR} -> ${NEWDIR}" 
    31   OLDLINE=`cat /etc/master.passwd | grep "^${USER}:" | cut -d ':' -f 4-` 
    32   NEWLINE=`echo $OLDLINE | sed "s|:${USERHOMEDIR}:|:${NEWDIR}:|g"` 
    33   sed -i '.bak' "s|${OLDLINE}|${NEWLINE}|g" /etc/master.passwd 
    34   pwd_mkdb -p /etc/master.passwd 
     23  echo "Warning: PEFS will not work with sym-linked home dirs.." 
    3524  USERHOMEDIR=`realpath $USERHOMEDIR` 
    3625fi 
    3726 
     27if [ "$USERHOMEDIR" = '/' ] ; then 
     28  echo "Bad USERHOMEDIR = /" 
     29  exit 1 
     30fi 
     31 
    3832echo "Encrypting ${USERHOMEDIR}" 
    39 umount ${USERHOMEDIR} 2>/dev/null 
     33#umount ${USERHOMEDIR} 2>/dev/null 
    4034 
    41 mv ${USERHOMEDIR} ${USERHOMEDIR}.$$ 
    42 mkdir ${USERHOMEDIR} 
     35cp -R ${USERHOMEDIR} ${USERHOMEDIR}.$$ 
     36rm -rf ${USERHOMEDIR}/* 
    4337chown ${USER}:${USER} ${USERHOMEDIR} 
    4438 
     
    4943mv ${USERHOMEDIR}/.pefs.db /tmp/.pefs.db.$$ 
    5044tar cvf - -C "${USERHOMEDIR}.$$" . 2>/dev/null | tar xvpf - -C "${USERHOMEDIR}" 2>/dev/null 
     45chown -R ${USER}:${USER} ${USERHOMEDIR} 
    5146 
    5247umount ${USERHOMEDIR} 
     
    7065fi 
    7166 
    72 # Copy /etc/pam.d/ template files 
    73 cp /usr/local/share/pcbsd/pefs/other /etc/pam.d/other 
    74 cp /usr/local/share/pcbsd/pefs/system /etc/pam.d/system 
Note: See TracChangeset for help on using the changeset viewer.