diff --git a/SPECS/openlitespeed.spec b/SPECS/openlitespeed.spec index a1cac0a..424caee 100644 --- a/SPECS/openlitespeed.spec +++ b/SPECS/openlitespeed.spec @@ -91,7 +91,7 @@ cp -pr dist/admin/conf/admin_config_ssl.conf.in %{buildroot}%{_lsws_dir}/admin/c sed -i -e "s:%ADMIN_PORT%:7080:g" %{buildroot}%{_lsws_dir}/admin/conf/admin_config.conf sed -i -e "s:%SSL_HOSTNAME%:webadmin:g" %{buildroot}%{_lsws_dir}/admin/conf/admin_config.conf install -m 755 -d %{buildroot}%{_unitdir} -cp %{buildroot}%{_lsws_dir}/admin/misc/lshttpd.service %{buildroot}%{_unitdir} +cp %{buildroot}%{_lsws_dir}/admin/misc/lshttpd.service %{buildroot}%{_unitdir}/lsws.service chmod u+w %{buildroot}%{_lsws_dir}/admin/misc/lsws.rc sed "s:%LSWS_CTRL%:/usr/lsws/bin/lswsctrl:" dist/admin/misc/lsws.rc.in > %{buildroot}%{_lsws_dir}/admin/misc/lsws.rc sed -i -e 's:fcgi-bin/lsphp:$SERVER_ROOT/lsphp73/bin/lsphp:g' %{buildroot}%{_lsws_dir}/conf/httpd_config.conf @@ -106,20 +106,30 @@ rm -f %{buildroot}%{_lsws_dir}/admin/misc/lsws.rc.gentoo %pre +if [ $1 -gt 1 ] ; then + getent group lsadm > /dev/null || groupadd -r lsadm lsadm_gid=`grep ^lsadm: /etc/group | awk -F : '{ print $3; }'` >/dev/null 2>&1 getent passwd lsadm > /dev/null || useradd -g $lsadm_gid -d / -r -s /sbin/nologin -c "lsadm" lsadm >/dev/null 2>&1 usermod -G lsadm,nobody lsadm >/dev/null 2>&1 exit 0 +fi + %preun +if [ $1 -gt 0 ] ; then %systemd_preun lsws +fi %postun +if [ $1 -gt 0 ] ; then userdel lsadm %systemd_postun lsws +fi %post +if [ $1 -gt 1 ] ; then + DEFAULT_USER="nobody" DEFAULT_GROUP="nobody" WS_USER=$DEFAULT_USER @@ -227,13 +237,15 @@ EOF openssl req -x509 -config $csr -extensions 'server_exts' -nodes -days 820 -newkey rsa:2048 -keyout %{sslkey} -out %{sslcert} chown lsadm.lsadm %{sslcert}; chmod 400 %{sslcert}; chown lsadm.lsadm %{sslkey}; chmod 400 %{sslkey}; -ln -s %{_lsws_dir}/fcgi-bin/lsphp5 %{_lsws_dir}/fcgi-bin/lsphp +ln -sf %{_lsws_dir}/fcgi-bin/lsphp5 %{_lsws_dir}/fcgi-bin/lsphp %systemd_post lsws echo "To change admin password run /usr/lsws/admin/misc/admpass.sh script" echo "To start the openlitespeed server, run the command: systemctl start lsws" +fi + %files %{_unitdir}/lshttpd.service