summaryrefslogtreecommitdiff
path: root/ffmpegfs/pre-install
blob: 67489c92c1c9c8c104e459b8bb351b8921cf632d (plain)
    1 #!/bin/sh
    2 
    3 # Created by Danny Rawlins, <crux at romster dot me>
    4 
    5 GROUP=ffmpegfs
    6 USER=ffmpegfs
    7 USER_COMMENT="FUSE-based transcoding filesystem"
    8 USER_HOME=/var/empty
    9 USER_SHELL=/bin/sh
   10 
   11 if [ ! $(id -u) = 0 ]; then
   12 	echo "ERROR: you need to be root to run this!"
   13 	exit 1
   14 fi
   15 
   16 if [ $GROUP ];	then
   17 	if ! getent group $GROUP > /dev/null; then
   18 		/usr/sbin/groupadd $GROUP
   19 		if [ $? -eq 0 ]; then
   20 			echo "Group: $GROUP added."
   21 		fi
   22 	else
   23 		echo "Group: $GROUP already exists! Skipping."
   24 	fi
   25 fi
   26 	
   27 if ! getent passwd $USER > /dev/null; then
   28 	/usr/sbin/useradd -g $GROUP -c "$USER_COMMENT" -d $USER_HOME -s $USER_SHELL $USER
   29 	if [ $? -eq 0 ]; then
   30 		echo "User: $USER added."
   31 		/usr/bin/passwd -l $USER > /dev/null
   32 		if [ $? -eq 0 ]; then
   33 			echo "Locked: $USER account."
   34 		fi
   35 		else
   36 			echo "ERROR: unable to lock $USER account."
   37 			/usr/sbin/userdel $USER
   38 	fi
   39 	else
   40 		echo "User: $USER already exists! Skipping."
   41 fi

Generated by cgit