#!/bin/bash # # cryptcreate: check if a homedir is mounted and encrypted # feedback: rhatto@riseup.net # # cryptcreate is free software; you can redistribute it and/or modify it under the # terms of the GNU General Public License as published by the Free Software # Foundation; either version 2 of the License, or any later version. # # cryptcreate is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR # A PARTICULAR PURPOSE. See the GNU General Public License for more details. # # You should have received a copy of the GNU General Public License along with # this program; if not, write to the Free Software Foundation, Inc., 59 Temple # Place - Suite 330, Boston, MA 02111-1307, USA # # $Rev$ - $Author$ # unset NULL USER=TRUE # to check whether is an user if [ -e "/etc/homecrypt.conf" ]; then source /etc/homecrypt.conf fi if [ -z "$HOME_BASE" ]; then HOME_BASE="/mnt/crypt/home" fi if [ -z "$HOME_IMG" ]; then HOME_IMG="/home" fi if [[ $1 == -nodaemon ]]; then USER=FALSE; elif [[ $1 == $NULL ]]; then ME=$(whoami) else ME=$1 fi if [[ $USER == TRUE ]]; then if (grep -q $HOME_BASE/$ME /etc/mtab); then true; else # $HOME partition is not mounted # maybe the user uses dm-crypt? if [ -f $HOME_IMG/$ME.img ]; then if [[ $(echo $DISPLAY) != $NULL ]]; then # X11 xsetroot -solid black xterm -geometry 70x2+300+360 -e sudo /usr/bin/homecrypt on $ME else # console sudo /usr/bin/homecrypt on $ME fi fi fi fi