Summary: Enables user web spave on the e-smith server and gateway. %define name smeserver-user-webspace Name: %{name} %define version 0.1 %define release 5.SME7 Version: %{version} Release: %{release} Copyright: GPL Group: Networking/Daemons Source: %{name}-%{version}.tar.gz Patch0: %{name}-%{version}.patch0 Patch1: %{name}-%{version}.patch1 Patch2: %{name}-%{version}.patch2 Packager: Jean-Philippe Pialasse BuildRoot: /var/tmp/e-smith-buildroot BuildArchitectures: noarch Requires: smeserver-release >= 7.0 AutoReqProv: no %description Enables the e-smith server and gateway to host user web pages from their home directories. Simply create a public_html directory inside your ~/home/ directory and any web pages placed there in will be available via the urls http://www/~user and http://www/user. %prep %setup rm createlinks rm -r root/etc/e-smith/events rm root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/90e-smithAccess50UserDir00 %patch0 -p1 rm root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/50UserDir00 %patch1 -p1 %patch2 -p1 %build %install rm -rf $RPM_BUILD_ROOT (cd root ; find . -depth -print | cpio -dump $RPM_BUILD_ROOT) rm -f %{name}-%{version}-filelist /sbin/e-smith/genfilelist $RPM_BUILD_ROOT > %{name}-%{version}-filelist %clean rm -rf $RPM_BUILD_ROOT %pre %preun %post if [ $1 = 1 ] ; then enable_user_webspace() { echo 'You now have the option to enable user web directories.' echo echo -n 'Would you like to enable User Directories? (y/N): ' read choice < /dev/tty if [ x$choice = xy ] ; then /sbin/e-smith/config set UserPublicWeb on /sbin/e-smith/expand-template /etc/httpd/conf/httpd.conf service httpd-e-smith restart elif [ x$choice = xY ] ; then /sbin/e-smith/config set UserPublicWeb on /sbin/e-smith/expand-template /etc/httpd/conf/httpd.conf service httpd-e-smith restart else /sbin/e-smith/config set UserPublicWeb off fi echo "adding html folder in user skeleton" mkdir -p /etc/e-smith/skel/user/home/public_html cp /etc/e-smith/events/actions/user-create-unix /tmp/user-create-unix cp /etc/e-smith/events/actions/user-create-unix /etc/e-smith/events/actions/user-create-unix.backup echo "modifying user folder permission in user-create-unix from chmod 0700 to chmod 0755" #cat /tmp/user-create-unix | sed -e "a|chmod 0700|chmod 0770, \"/home/e-smith/files/users/\$userName/home/public_html\";|g" |sed -e "a|chmod 0700|chown \$userName:www, \"/home/e-smith/files/users/\$userName\" |g"|sed -e "s|chmod 0700|chmod 0710|g" > /etc/e-smith/events/actions/user-create-unix sed -e "/chmod 0700/{ s|chmod 0700|chmod 0710| a \\ chmod 0770, \"/home/e-smith/files/users/\$userName/home/public_html\"; a \\ system(\"/bin/chown\", \":www\", \"/home/e-smith/files/users/\$userName/home/public_html\"); a\\ system(\"/bin/chown\", \":www\", \"/home/e-smith/files/users/\$userName\"); }" /etc/e-smith/events/actions/user-create-unix.backup > /etc/e-smith/events/actions/user-create-unix echo "modifying existing users spaces" ls -1 /home/e-smith/files/users/ >/tmp/listeusers cat /tmp/listeusers|while read line do if [ "admin" != "$line" ] then chmod 0710 /home/e-smith/files/users/$line echo "chmod $line:www /home/e-smith/files/users/$line" chown $line:www /home/e-smith/files/users/$line mkdir -p /home/e-smith/files/users/$line/home/public_html chown -R $line:www /home/e-smith/files/users/$line/home/public_html chmod -R 2770 /home/e-smith/files/users/$line/home/public_html fi done } enable_user_webspace fi %postun if [ $1 = 0 ] ; then /sbin/e-smith/config delete UserPublicWeb /sbin/e-smith/expand-template /etc/httpd/conf/httpd.conf service httpd-e-smith restart cp /etc/e-smith/events/actions/user-create-unix /tmp/user-create-unix echo "modifying user folder permission in user-create-unix from chmod 0755 to chmod 0700" sed -e "/chmod 0770/d" /tmp/user-create-unix > /tmp/user-create-unix2 sed -e "s|chmod 0710|chmod 0700|g" /tmp/user-create-unix2 > /tmp/user-create-unix3 sed -e "/chown/d" /tmp/user-create-unix3 > /etc/e-smith/events/actions/user-create-unix echo "removing html folder in user directory skeleton" rm -r /etc/e-smith/skel/user/home/public_html ls -1 /home/e-smith/files/users/ >/tmp/listeusers cat /tmp/listeusers|while read line do if [ "admin" != "$line" ] then chmod -R 0755 /home/e-smith/files/users/$line chmod 0700 /home/e-smith/files/users/$line chown -R $line:$line /home/e-smith/files/users/$line fi done fi %files -f %{name}-%{version}-filelist %defattr(-,root,root) %changelog * Fri Sep 08 2006 Jean-Philippe Pialasse - adaptation ot the contrib to the SME 7 architecture * Thu Nov 23 2000 Damien Curtain - Moved the userdir template into templates-custom, utilising - a new feature of e-smith-4.0.1 and greater. * Wed Nov 22 2000 Damien Curtain - Added new templates. Added then removed;) ability to - set userdir. Added www/user aliases. Post install script - to prompt people to turn this on/off. * Tue Nov 21 2000 Paul Nesbit - initial release