1 |
Summary: Enables user web spave on the e-smith server and gateway. |
2 |
%define name smeserver-user-webspace |
3 |
Name: %{name} |
4 |
%define version 0.1 |
5 |
%define release 5.SME7 |
6 |
Version: %{version} |
7 |
Release: %{release} |
8 |
Copyright: GPL |
9 |
Group: Networking/Daemons |
10 |
Source: %{name}-%{version}.tar.gz |
11 |
Patch0: %{name}-%{version}.patch0 |
12 |
Patch1: %{name}-%{version}.patch1 |
13 |
Patch2: %{name}-%{version}.patch2 |
14 |
Packager: Jean-Philippe Pialasse <unnilennium@pialasse.com> |
15 |
BuildRoot: /var/tmp/e-smith-buildroot |
16 |
BuildArchitectures: noarch |
17 |
Requires: smeserver-release >= 7.0 |
18 |
AutoReqProv: no |
19 |
|
20 |
%description |
21 |
Enables the e-smith server and gateway to host user web pages |
22 |
from their home directories. Simply create a public_html directory |
23 |
inside your ~/home/ directory and any web pages placed there in |
24 |
will be available via the urls http://www/~user and http://www/user. |
25 |
|
26 |
%prep |
27 |
%setup |
28 |
rm createlinks |
29 |
rm -r root/etc/e-smith/events |
30 |
rm root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/90e-smithAccess50UserDir00 |
31 |
|
32 |
%patch0 -p1 |
33 |
rm root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/50UserDir00 |
34 |
%patch1 -p1 |
35 |
%patch2 -p1 |
36 |
|
37 |
%build |
38 |
|
39 |
%install |
40 |
rm -rf $RPM_BUILD_ROOT |
41 |
(cd root ; find . -depth -print | cpio -dump $RPM_BUILD_ROOT) |
42 |
rm -f %{name}-%{version}-filelist |
43 |
/sbin/e-smith/genfilelist $RPM_BUILD_ROOT > %{name}-%{version}-filelist |
44 |
|
45 |
%clean |
46 |
rm -rf $RPM_BUILD_ROOT |
47 |
|
48 |
%pre |
49 |
%preun |
50 |
%post |
51 |
if [ $1 = 1 ] ; then |
52 |
enable_user_webspace() { |
53 |
|
54 |
echo 'You now have the option to enable user web directories.' |
55 |
echo |
56 |
echo -n 'Would you like to enable User Directories? (y/N): ' |
57 |
|
58 |
read choice < /dev/tty |
59 |
|
60 |
if [ x$choice = xy ] ; then |
61 |
/sbin/e-smith/config set UserPublicWeb on |
62 |
/sbin/e-smith/expand-template /etc/httpd/conf/httpd.conf |
63 |
service httpd-e-smith restart |
64 |
elif [ x$choice = xY ] ; then |
65 |
/sbin/e-smith/config set UserPublicWeb on |
66 |
/sbin/e-smith/expand-template /etc/httpd/conf/httpd.conf |
67 |
service httpd-e-smith restart |
68 |
else |
69 |
/sbin/e-smith/config set UserPublicWeb off |
70 |
fi |
71 |
|
72 |
echo "adding html folder in user skeleton" |
73 |
mkdir -p /etc/e-smith/skel/user/home/public_html |
74 |
cp /etc/e-smith/events/actions/user-create-unix /tmp/user-create-unix |
75 |
cp /etc/e-smith/events/actions/user-create-unix /etc/e-smith/events/actions/user-create-unix.backup |
76 |
echo "modifying user folder permission in user-create-unix from chmod 0700 to chmod 0755" |
77 |
#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 |
78 |
|
79 |
sed -e "/chmod 0700/{ |
80 |
s|chmod 0700|chmod 0710| |
81 |
a \\ |
82 |
chmod 0770, \"/home/e-smith/files/users/\$userName/home/public_html\"; |
83 |
a \\ |
84 |
system(\"/bin/chown\", \":www\", \"/home/e-smith/files/users/\$userName/home/public_html\"); |
85 |
a\\ |
86 |
system(\"/bin/chown\", \":www\", \"/home/e-smith/files/users/\$userName\"); |
87 |
}" /etc/e-smith/events/actions/user-create-unix.backup > /etc/e-smith/events/actions/user-create-unix |
88 |
|
89 |
echo "modifying existing users spaces" |
90 |
ls -1 /home/e-smith/files/users/ >/tmp/listeusers |
91 |
cat /tmp/listeusers|while read line |
92 |
do |
93 |
if [ "admin" != "$line" ] |
94 |
then |
95 |
chmod 0710 /home/e-smith/files/users/$line |
96 |
echo "chmod $line:www /home/e-smith/files/users/$line" |
97 |
chown $line:www /home/e-smith/files/users/$line |
98 |
mkdir -p /home/e-smith/files/users/$line/home/public_html |
99 |
chown -R $line:www /home/e-smith/files/users/$line/home/public_html |
100 |
chmod -R 2770 /home/e-smith/files/users/$line/home/public_html |
101 |
|
102 |
fi |
103 |
done |
104 |
} |
105 |
|
106 |
enable_user_webspace |
107 |
fi |
108 |
|
109 |
%postun |
110 |
if [ $1 = 0 ] ; then |
111 |
/sbin/e-smith/config delete UserPublicWeb |
112 |
/sbin/e-smith/expand-template /etc/httpd/conf/httpd.conf |
113 |
service httpd-e-smith restart |
114 |
cp /etc/e-smith/events/actions/user-create-unix /tmp/user-create-unix |
115 |
echo "modifying user folder permission in user-create-unix from chmod 0755 to chmod 0700" |
116 |
sed -e "/chmod 0770/d" /tmp/user-create-unix > /tmp/user-create-unix2 |
117 |
sed -e "s|chmod 0710|chmod 0700|g" /tmp/user-create-unix2 > /tmp/user-create-unix3 |
118 |
sed -e "/chown/d" /tmp/user-create-unix3 > /etc/e-smith/events/actions/user-create-unix |
119 |
echo "removing html folder in user directory skeleton" |
120 |
rm -r /etc/e-smith/skel/user/home/public_html |
121 |
ls -1 /home/e-smith/files/users/ >/tmp/listeusers |
122 |
cat /tmp/listeusers|while read line |
123 |
do |
124 |
if [ "admin" != "$line" ] |
125 |
then |
126 |
chmod -R 0755 /home/e-smith/files/users/$line |
127 |
chmod 0700 /home/e-smith/files/users/$line |
128 |
chown -R $line:$line /home/e-smith/files/users/$line |
129 |
fi |
130 |
done |
131 |
|
132 |
fi |
133 |
|
134 |
%files -f %{name}-%{version}-filelist |
135 |
%defattr(-,root,root) |
136 |
|
137 |
%changelog |
138 |
* Fri Sep 08 2006 Jean-Philippe Pialasse <unnilennium@pialasse.com> |
139 |
- adaptation ot the contrib to the SME 7 architecture |
140 |
* Thu Nov 23 2000 Damien Curtain <damien@pagefault.org> |
141 |
- Moved the userdir template into templates-custom, utilising |
142 |
- a new feature of e-smith-4.0.1 and greater. |
143 |
|
144 |
* Wed Nov 22 2000 Damien Curtain <damien@pagefault.org> |
145 |
- Added new templates. Added then removed;) ability to |
146 |
- set userdir. Added www/user aliases. Post install script |
147 |
- to prompt people to turn this on/off. |
148 |
|
149 |
* Tue Nov 21 2000 Paul Nesbit <pkn@e-smith.com> |
150 |
- initial release |