311 lines
12 KiB
RPMSpec
Executable File
311 lines
12 KiB
RPMSpec
Executable File
# $Id: smeserver-mediawiki.spec,v 1.21 2023/07/24 15:04:26 brianr Exp $
|
|
# Authority: ber_die
|
|
# Name: Dietmar Berteld
|
|
|
|
%define name smeserver-mediawiki
|
|
%define version 1.39.4
|
|
%define release 2
|
|
|
|
Summary: Mediawiki Web Application for SME Server 10.x based on Mediawiki 1.39.0
|
|
Name: %{name}
|
|
Version: %{version}
|
|
Release: %{release}%{?dist}
|
|
License: GPL
|
|
Group: /Web/Applications
|
|
Source: %{name}-%{version}.tar.xz
|
|
|
|
#Patch0: smeserver-mediawiki-1.38.2-bz12133-httpd24.patch
|
|
#Patch1: smeserver-mediawiki-1.38.2-bz12134-backup.patch
|
|
|
|
URL: http://mediawiki.org/
|
|
BuildRoot: /var/tmp/%{name}-%{version}-%{release}-buildroot
|
|
BuildArch: noarch
|
|
Requires: e-smith-base, e-smith-release >= 10
|
|
Requires: e-smith-apache >= 2.6.0-19
|
|
Requires: smeserver-php >= 3.0.0-43
|
|
BuildRequires: e-smith-devtools
|
|
|
|
%description
|
|
This RPM is an addon for the SME Server v10
|
|
The target audience is the Linux/E-smith administrator
|
|
who wants to add Wikipedia-SW.
|
|
Mediawiki is a very popular Wiki and is used by the wikipedia-project.
|
|
After installation open your webbrowser your local site
|
|
http://your_e-smith-server_adress/wiki
|
|
|
|
%changelog
|
|
* Sat Sep 07 2024 cvs2git.sh aka Brian Read <brianr@koozali.org> 1.39.4-2.sme
|
|
- Roll up patches and move to git repo [SME: 12338]
|
|
|
|
* Sat Sep 07 2024 BogusDateBot
|
|
- Eliminated rpmbuild "bogus date" warnings due to inconsistent weekday,
|
|
by assuming the date is correct and changing the weekday.
|
|
|
|
|
|
* Sat Jul 22 2023 Brian Read <brianr@koozali.org> 1.39.4-1.sme
|
|
- Update to LTS version 1.39.4 (Supported until dec 2025)[SME: 12385]
|
|
|
|
* Thu Dec 01 2022 Brian Read <brianr@bjsystems.co.uk> 1.39.0-1.sme
|
|
- Update to LTS version 1.39.0 (Supported until dec 2025)[SME: 12250]
|
|
|
|
* Tue Aug 02 2022 Jean-Philippe Pialasse <tests@pialasse.com> 1.38.2-2.sme
|
|
- update to httpd 2.4 access syntax [SME: 12133]
|
|
- add to core backup [SME: 12134]
|
|
|
|
* Tue Jul 12 2022 Brian Read <brianr@bjsystems.co.uk> 1.38.2-1.sme
|
|
- Update version to Mediawiki-1.38.2 [sme: 11987]
|
|
- Fix initial admin user password
|
|
|
|
* Thu Jun 09 2022 Brian Read <brianr@bjsystems.co.uk> 1.38.1-2.sme
|
|
- fix sql user create [SME: 11987]
|
|
|
|
* Wed Jun 08 2022 Brian Read <brianr@bjsystems.co.uk> 1.38.0-2.sme
|
|
- Update version to Mediawiki-1.38.1 [sme: 11987]
|
|
|
|
* Fri Jun 03 2022 Brian Read <brianr@bjsystems.co.uk> 1.38.0-2.sme
|
|
- update sql create [SME: 11987]
|
|
|
|
* Fri Jun 03 2022 Brian Read <brianr@bjsystems.co.uk> 1.38.0-1.sme
|
|
- Rollup tar file to include mediawiki 1.38.0 [SME: 11987]
|
|
|
|
* Wed Jun 01 2022 Brian Read <brianr@bjsystems.co.uk> 1.37.2-3.sme
|
|
- Fix-up-password-generation-and-localsettings [SME: 11987]
|
|
|
|
* Wed Jun 01 2022 BogusDateBot
|
|
- Eliminated rpmbuild "bogus date" warnings due to inconsistent weekday,
|
|
by assuming the date is correct and changing the weekday.
|
|
Thu Oct 23 2007 --> Thu Oct 18 2007 or Tue Oct 23 2007 or Thu Oct 25 2007 or ....
|
|
Thu Feb 26 2008 --> Thu Feb 21 2008 or Tue Feb 26 2008 or Thu Feb 28 2008 or ....
|
|
|
|
* Tue May 31 2022 Brian Read <brianr@bjsystems.co.uk> 1.6.10-10 sme
|
|
- Update to SME10 [SME:11987]
|
|
- Add php-fpm stuff to httpd.conf
|
|
- Update to mw 1.37.2
|
|
|
|
* Mon May 12 2008 Dietmar Berteld> 1.6.10-9
|
|
- Disabing automatic creation of SME groups. No idea to synchronise them to mediawiki groups.
|
|
|
|
* Mon May 12 2008 Dietmar Berteld> 1.6.10-8
|
|
- Adding PwAuth-function, SME users can login with their SME passwords
|
|
Automatic creation of a few default mw_groups and list them in the
|
|
configuration file as well so admins only need to add users to the proper
|
|
groups in the server-manager
|
|
|
|
* Tue Feb 26 2008 Dietmar Berteld>
|
|
Thu Feb 26 2008 --> Thu Feb 21 2008 or Tue Feb 26 2008 or Thu Feb 28 2008 or ....
|
|
- [1.6.10-7] Fixed httpd-settings for local access only
|
|
|
|
* Tue Oct 23 2007 Dietmar Berteld>
|
|
Thu Oct 23 2007 --> Thu Oct 18 2007 or Tue Oct 23 2007 or Thu Oct 25 2007 or ....
|
|
- [1.6.10-6] Fixed automated uninstall issue for MySQL-DB and MySQL-user
|
|
|
|
* Fri Oct 19 2007 Dietmar Berteld>
|
|
- [1.6.10-5] Fixed short URL's
|
|
- Improved Apache template for better security
|
|
- Improved integration in SME (PublicAccess local/global - global)
|
|
|
|
* Wed Oct 10 2007 Sylvain Gomez <sylvaingomez@free.fr>
|
|
- [1.6.10-4] Fixed short URL's
|
|
Fixed Apache restarting at the wrong time while uninstalling
|
|
Added missing MySQL User
|
|
Added automatic lang detection at install stage
|
|
Changed sme.png logo
|
|
|
|
* Wed Sep 05 2007 Dietmar Berteld <dietmar@berteld.com>
|
|
- [1.6.10-3] Simpler method to create MySQL-Datebase
|
|
Using short URL's
|
|
|
|
* Wed Apr 25 2007 Dietmar Berteld <dietmar@berteld.com>
|
|
- [1.6.10-2] Security Improvements (template, MySQL, directory-rights)
|
|
Thanks for the help to Sylvain Gomez <sylvain.gomez@free.fr>
|
|
|
|
* Thu Apr 12 2007 Dietmar Berteld <dietmar@berteld.com>
|
|
- [1.6.10-1] Initial version
|
|
|
|
%prep
|
|
rm -rf $RPM_BUILD_ROOT
|
|
|
|
%setup
|
|
|
|
#%patch0 -p1
|
|
#%patch1 -p1
|
|
|
|
%build
|
|
perl createlinks
|
|
|
|
%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
|
|
|
|
UPDATE=$(ls /opt | grep -c mediawiki)
|
|
case $UPDATE in
|
|
0)
|
|
echo "Installing MediaWiki... Please wait!"
|
|
;;
|
|
*)
|
|
echo "Updating MediaWiki... Please wait!"
|
|
mkdir -p /opt/MW_RPM_BACKUP
|
|
cd /opt
|
|
echo "Backing up installation files..."
|
|
tar -czf /opt/MW_RPM_BACKUP/mediawiki.tar.gz mediawiki
|
|
echo "Backing up MySQL database..."
|
|
mysqldump mediawiki > /opt/MW_RPM_BACKUP/mediawiki.sql
|
|
/sbin/e-smith/db configuration show mediawiki > /opt/MW_RPM_BACKUP/config.txt
|
|
;;
|
|
esac
|
|
|
|
%post
|
|
|
|
# General Information
|
|
/etc/e-smith/events/actions/initialize-default-databases
|
|
# General Information
|
|
APP=MediaWiki
|
|
URL=wiki
|
|
WORKDIR=/root
|
|
MEDIAWIKIVERSION='1.39.4'
|
|
INSTALLDIR=/usr/share/doc/mediawiki-$MEDIAWIKIVERSION/Sources
|
|
HTMLDIR=/opt/mediawiki
|
|
MYSQLDB=mediawiki
|
|
MYSQLUSER=mediawikiuser
|
|
MYSQLPASS=$(/sbin/e-smith/db configuration getprop mediawiki DbPassword)
|
|
DOMAIN=$(/sbin/e-smith/db configuration get DomainName)
|
|
SRVNAME=$(/sbin/e-smith/db configuration get SystemName)
|
|
UPDATE=$(ls /opt | grep -c mediawiki)
|
|
grep "LANG=" /etc/sysconfig/i18n > lang1
|
|
sed -e 's/LANG="//g' lang1 > lang2
|
|
sed -e 's/"//g' lang2 > lang
|
|
LANG=$(cat lang)
|
|
rm -rf lang*
|
|
#Untar application
|
|
echo "Decompressing files..."
|
|
mkdir -p $HTMLDIR
|
|
tar xzf $INSTALLDIR/mediawiki-$MEDIAWIKIVERSION.tar.gz -C /opt
|
|
case $UPDATE in
|
|
0) mv -f /opt/mediawiki-$MEDIAWIKIVERSION/* $HTMLDIR ;;
|
|
*) cp -ufR /opt/mediawiki-$MEDIAWIKIVERSION/* $HTMLDIR ;;
|
|
esac
|
|
rm -rf /opt/mediawiki-$MEDIAWIKIVERSION
|
|
cp $INSTALLDIR/sme.* $HTMLDIR/skins/common/images
|
|
#Prepare config settings
|
|
sed 's.mediawikipassword.'$MYSQLPASS'.g' $INSTALLDIR/LocalSettings.php > $HTMLDIR/LocalSettings.php
|
|
sed "s/mydomain/$DOMAIN/g" $HTMLDIR/LocalSettings.php > $HTMLDIR/LocalSettings1.php
|
|
sed "s/myhost/$SRVNAME/g" $HTMLDIR/LocalSettings1.php > $HTMLDIR/LocalSettings2.php
|
|
case "$LANG" in
|
|
de_DE) sed 's.$wgLanguageCode = "en";.$wgLanguageCode = "de";.g' $HTMLDIR/LocalSettings2.php > $HTMLDIR/LocalSettings.php ;;
|
|
es_ES) sed 's.$wgLanguageCode = "en";.$wgLanguageCode = "es";.g' $HTMLDIR/LocalSettings2.php > $HTMLDIR/LocalSettings.php ;;
|
|
fr_FR) sed 's.$wgLanguageCode = "en";.$wgLanguageCode = "fr";.g' $HTMLDIR/LocalSettings2.php > $HTMLDIR/LocalSettings.php ;;
|
|
it_IT) sed 's.$wgLanguageCode = "en";.$wgLanguageCode = "it";.g' $HTMLDIR/LocalSettings2.php > $HTMLDIR/LocalSettings.php ;;
|
|
*) sed 's.$wgLanguageCode = "en";.$wgLanguageCode = "en";.g' $HTMLDIR/LocalSettings2.php > $HTMLDIR/LocalSettings.php ;;
|
|
esac
|
|
rm $HTMLDIR/LocalSettings1.php
|
|
rm $HTMLDIR/LocalSettings2.php
|
|
#cp $INSTALLDIR/PwAuthPlugin.php $HTMLDIR/extensions/PwAuthPlugin.php
|
|
#Creating SME-Groups for MediaWiki (disabled)
|
|
#/sbin/e-smith/db accounts set mw_read group
|
|
#/sbin/e-smith/db accounts setprop mw_read Description "MediaWiki Read"
|
|
#/sbin/e-smith/db accounts set mw_edit group
|
|
#/sbin/e-smith/db accounts setprop mw_edit Description "MediaWiki Edit"
|
|
#/sbin/e-smith/db accounts set mw_createpage group
|
|
#/sbin/e-smith/db accounts setprop mw_createpage Description "MediaWiki Create Page"
|
|
#/sbin/e-smith/db accounts set mw_createtalk group
|
|
#/sbin/e-smith/db accounts setprop mw_createtalk Description "MediaWiki Create Talk"
|
|
#/sbin/e-smith/signal-event group-create
|
|
#Changing some rights
|
|
chmod 644 $HTMLDIR/extensions/PwAuthPlugin.php
|
|
chown -R root:root $HTMLDIR
|
|
chown root:www $HTMLDIR/images
|
|
chown root:www $HTMLDIR/LocalSettings.php
|
|
chmod 775 $HTMLDIR/images
|
|
chmod 440 $HTMLDIR/LocalSettings.php
|
|
#Creating DataBase
|
|
echo "MySQL installation:"
|
|
case $UPDATE in
|
|
0)
|
|
echo "Creating MySQL User and DataBase..."
|
|
mysqladmin -u root create $MYSQLDB
|
|
mysql $MYSQLDB < $INSTALLDIR/$MYSQLDB.sql
|
|
mysql $MYSQLDB -e "UPDATE user SET user_password = MD5( CONCAT( user_id, '-', MD5( 'mediawikiadmin' ) ) ) WHERE user_id =1 "
|
|
mysql -u root -e "SET PASSWORD FOR $MYSQLUSER@localhost = PASSWORD( '$MYSQLPASS' ) "
|
|
mysqladmin flush-privileges
|
|
;;
|
|
*)
|
|
echo "Fixing MySQL rights..."
|
|
mysql -u root -e "SET PASSWORD FOR $MYSQLUSER@localhost = PASSWORD( '$MYSQLPASS' ) "
|
|
mysqladmin flush-privileges
|
|
;;
|
|
esac
|
|
# Rebuilding Wiki language menus
|
|
#php $HTMLDIR/maintenance/rebuildMessages.php --rebuild
|
|
#echo "Applying modifications to services..."
|
|
# Uncomment the PwAuth-function
|
|
sed 's.#!..g' $HTMLDIR/LocalSettings.php > $HTMLDIR/LocalSettings2.php
|
|
mv $HTMLDIR/LocalSettings2.php $HTMLDIR/LocalSettings.php
|
|
#Handled in the -update event
|
|
#/sbin/e-smith/expand-template /etc/httpd/conf/httpd.conf
|
|
#systemctl restart httpd-e-smith.service
|
|
echo "-------------------------------------------------------------------------------"
|
|
case $UPDATE in
|
|
0)
|
|
echo "$APP Installation completed."
|
|
echo "Reminder:"
|
|
echo "- Website open globally"
|
|
echo "- go to http://$DOMAIN/$URL"
|
|
#echo "- Usernames are identical with SME users"
|
|
#echo "- Passwords are identical with SME passwords"
|
|
echo "- MediaWiki admin = SME admin"
|
|
;;
|
|
*)
|
|
echo "$APP update completed."
|
|
echo "Reminder:"
|
|
echo "- The old install was backed up and can be found in /opt/MW_RPM_BACKUP"
|
|
echo " PLEASE MOVE THIS DIRECTORY TO A SAFE PLACE!!!"
|
|
echo "- Website open globally"
|
|
echo "- go to http://$DOMAIN/$URL"
|
|
#echo "- Usernames are identical with SME users"
|
|
#echo "- Passwords are identical with SME passwords"
|
|
echo "- MediaWiki admin = SME admin"
|
|
;;
|
|
esac
|
|
echo "-------------------------------------------------------------------------------"
|
|
echo "Following DB parameters are allowed:"
|
|
echo " # config setprop $MYSQLDB HTTPS on/off"
|
|
echo " # config setprop $MYSQLDB PublicAccess local/global"
|
|
echo " "
|
|
echo "Don't forget to apply modifications with following commands:"
|
|
echo " # expand-template /etc/httpd/conf/httpd.conf"
|
|
echo " # systemctl restart httpd-e-smith.service"
|
|
echo " "
|
|
echo "For more details, see http://wiki.contribs.org/Mediawiki"
|
|
echo "-------------------------------------------------------------------------------"
|
|
|
|
%preun
|
|
MEDIAWIKIVERSION='1.39.4'
|
|
INSTALLDIR=/usr/share/doc/mediawiki-$MEDIAWIKIVERSION/Sources
|
|
if [ $1 = 0 ] ; then
|
|
mv $INSTALLDIR/DO_NOT_USE_OR_DELETE/MW-Full-Uninstall.sh /root/
|
|
fi
|
|
|
|
%postun
|
|
if [ $1 = 0 ] ; then
|
|
echo "Restarting services..."
|
|
/sbin/e-smith/expand-template /etc/httpd/conf/httpd.conf
|
|
#/usr/local/bin/svc -h /service/httpd-e-smith
|
|
systemctl restart httpd-e-smith.service
|
|
echo " "
|
|
echo "Uninstallation finished!"
|
|
echo "If you want to completly remove it (installation files and MySQL user+database)"
|
|
echo "please issue the following command at the prompt:"
|
|
echo "# sh /root/MW-Full-Uninstall.sh"
|
|
fi
|
|
|
|
%files -f %{name}-%{version}-filelist
|
|
|
|
%defattr(-,root,root)
|