Sophie

Sophie

distrib > Mandriva > 2009.0 > i586 > by-pkgid > 93bbc1cf04c0beb7699e870a99ea4253 > files > 2

mille-xterm-appserver-1.0-0.2137.3mdv2009.0.src.rpm

%define svn 2137

Summary:	Mille-xterm application server meta-package
Name:		mille-xterm-appserver
Version:	1.0
Release:	%mkrel 0.%{svn}.3
License:	GPLv2+ and LGPLv2+
Group:		System/Servers
URL:		http://mille-xterm.revolutionlinux.com/mille-xterm
Source0:	%{name}-%{version}.tar.bz2
Requires:	gdm
Requires:	mille-xterm-loadbalancer-lbagent
Requires:	mille-xterm-configurator-clients
Requires:	mille-xterm-soundapplet
Requires:	mille-xterm-print1
Requires:	mille-xterm-print1-lpr
Requires:	mille-xterm-sessreg
Requires:	cups-common
Requires:	python >= 2.4
Requires:	openssh-clients
Requires:	ltspfs 
Requires:	kdebase-progs
Requires:	gimp
Requires:	scribus
Requires:	xmms xmms-esd
Requires:	xine-ui xine-esd
Requires:	apache-mod_php
Requires:	perl-IO-Socket-SSL
Requires:	ncpfs
Requires:	rsync
BuildRequires:	python-devel >= 2.4
BuildArch:	noarch
BuildRoot:	%{_tmppath}/%{name}-%{version}-%{release}-buildroot

%description
The mille-xterm application server is the component that terminal will connect
to get their display. It has a full desktop installed and configured for users.

This packages requires other packages to build a complete desktop, and install
login scripts specific to mille-xterm.

%prep

%setup -q

%build
python setup.py build

%install
rm -fr %{buildroot}

# Copy login scripts into %{_sysconfdir}
mkdir -p %{buildroot}%{_initrddir}
cp -a src/mille-xterm %{buildroot}%{_sysconfdir}
cp -a src/multimedia/xtermesd %{buildroot}%{_initrddir}

# Copy gdm related files
suffix=".mxapp"
mkdir -p %{buildroot}%{_sysconfdir}/X11/gdm/PostSession
mkdir -p %{buildroot}%{_sysconfdir}/X11/gdm/PreSession
cp src/gdm/PostSession/Default %{buildroot}%{_sysconfdir}/X11/gdm/PostSession/.Default$suffix
cp src/gdm/PreSession/Default  %{buildroot}%{_sysconfdir}/X11/gdm/PreSession/.Default$suffix
cp src/gdm/Xsession %{buildroot}%{_sysconfdir}/X11/gdm/.Xsession$suffix
cp src/gdm/gdm.conf %{buildroot}%{_sysconfdir}/X11/gdm/.gdm.conf$suffix

cp src/gdm/killsessions %{buildroot}%{_sysconfdir}/X11/gdm/
cp src/gdm/startsession %{buildroot}%{_sysconfdir}/X11/gdm/
cp src/gdm/stopsession %{buildroot}%{_sysconfdir}/X11/gdm/
cp src/gdm/cleanup %{buildroot}%{_sysconfdir}/X11/gdm/

mkdir -p %{buildroot}%{_sysconfdir}/X11/xsetup.d
cp src/xsetup.d/* %{buildroot}%{_sysconfdir}/X11/xsetup.d


# Local applications
mkdir -p %{buildroot}/%{_bindir}
cp src/multimedia/*runlocal %{buildroot}/%{_bindir} 

# Customization
mkdir -p %{buildroot}%{_sysconfdir}
cp -a src/custom %{buildroot}%{_sysconfdir}

mkdir -p %{buildroot}/var/www/html
cp src/html/* %{buildroot}/var/www/html

# application
python setup.py install --root=$RPM_BUILD_ROOT --record=INSTALLED_FILES

# Personnalization
pushd src/custom
mkdir -p %{buildroot}%{_datadir}/apps/ksplash/Themes/
mkdir -p %{buildroot}%{_datadir}/gdm/themes/
mkdir -p %{buildroot}%{_datadir}/icons/
mkdir -p %{buildroot}%{_datadir}/autostart/
mkdir -p %{buildroot}%{_bindir}
pushd %{buildroot}%{_prefix}/
pushd bin
for files in ../..%{_sysconfdir}/custom/bin/*; do ln -sf $files .;done
popd
pushd share/apps/ksplash/Themes
ln -sf ../../../../..%{_sysconfdir}/custom/share/apps/ksplash/Themes/OEM .
popd
pushd share/autostart
for files in ../../..%{_sysconfdir}/custom/share/autostart/*; do ln -sf $files .;done
popd
pushd share/gdm/themes
ln -sf ../../../..%{_sysconfdir}/custom/share/gdm/themes/millexterm .
popd
pushd share/icons
ln -sf ../../..%{_sysconfdir}/custom/share/icons/OEM .
popd
popd
popd

# Default KDE profile
mkdir -p %{buildroot}%{_sysconfdir}
cp -r src/kiosktool/* %{buildroot}%{_sysconfdir}/

# This file is needed to make KDE profile working
mkdir -p %{buildroot}%{_sysconfdir}/menu
touch %{buildroot}%{_sysconfdir}/menu/disable_mdk_customization

%clean
rm -rf %{buildroot}

%post
# We have to manage 4 files that are part of other packages
# It's safe to do that because they are managed as config files in other packages

# First, make a backup
for file in 	%{_sysconfdir}/X11/gdm/PostSession/Default 	\
		%{_sysconfdir}/X11/gdm/PreSession/Default		\
		%{_sysconfdir}/X11/gdm/Xsession			\
		%{_sysconfdir}/X11/gdm/gdm.conf
do
	DN=`dirname $file`
	BN=`basename $file`
	if [ -f $file ]; then
		# Do not overwrite already existing
		# backup (in case of upgrade)
		if [ ! -f $DN/.$BN.orig ]; then
			if [ -f $file.mille_xterm_saved ]; then
				mv -f $file.mille_xterm_saved $DN/.$BN.orig
			else
				mv -f $file $DN/.$BN.orig
			fi
		fi
	fi
	# Now, copy mille-xterm config files to replace existing ones
	cp -f  $DN/.$BN.mxapp $file
done

replace() {
    # $1 is the regexp, $2 is the file
    echo "Message : Automatic modification of file $2"
    if [ -e $2 ]; then
	perl -pi -e "$1" $2
    fi
}

# Replace the xfs to accept connexions from terminals
replace "s|-1|7100|g;" %{_initrddir}/xfs
if [ -f %{_sysconfdir}/X11/xorg.conf ]; then
  replace "s|-1|7100|g;" %{_sysconfdir}/X11/xorg.conf
fi
replace "s|no-listen|#no-listen|g;" %{_sysconfdir}/X11/fs/config
replace "s|client-limit.*=.*|client-limit=100|g;" %{_sysconfdir}/X11/fs/config

#If it's a new install
if [ "$1" = "1" ]; then
  if [ -f %{_datadir}/apps/ksmserver/pics/shutdownkonq.png ]; then
    cp %{_datadir}/apps/ksmserver/pics/shutdownkonq.png \
      %{_datadir}/apps/ksmserver/pics/shutdownkonq.png.old
    ln -sf %{_sysconfdir}/custom/share/apps/ksmserver/pics/shutdownkonq.png \
      %{_datadir}/apps/ksmserver/pics
  fi
  if [ -f %{_datadir}/doc/HTML/index.html ]; then
    cp %{_datadir}/doc/HTML/index.html %{_datadir}/doc/HTML/index.html.old
    ln -sf %{_sysconfdir}/custom/share/doc/HTML/index.html \
      %{_datadir}/doc/HTML
  fi
  ln -sf %{_sysconfdir}/custom/share/mdk/backgrounds/default.png \
    %{_datadir}/mdk/backgrounds
  mkdir -p %{_sysconfdir}/kde/.old
  for file in `ls %{_sysconfdir}/custom/kde`; do
    mv %{_sysconfdir}/kde/$file /etc/kde/.old/$file >/dev/null 2>&1
    ln -sf %{_sysconfdir}/custom/kde/$file /etc/kde
  done
  mv %{_datadir}/apps/kdesktop/DesktopLinks/device.desktop \
	%{_datadir}/apps/kdesktop/DesktopLinks/.device.desktop
  for i in krandrinithack krandrtray; do
    mv %{_bindir}/$i %{_bindir}/$i.old 2>/dev/null
  done
  chkconfig --levels 35 xtermesd on

  echo -e "\nInstallation complete !\nNow you can execute : mille-xterm-appserver autoconfigure"
  echo -e "This will configure your new application server...\n"
fi


%preun
#Only if package is uninstalled
if [ "$1" = "0" ]; then
  chkconfig --levels 35 xtermesd off
fi

%postun
#Only if package is uninstalled
if [ "$1" = "0" ]; then
  # Replace original files in case of uninstall
  for file in 	%{_sysconfdir}/X11/gdm/PostSession/Default 	\
		%{_sysconfdir}/X11/gdm/PreSession/Default		\
		%{_sysconfdir}/X11/gdm/Xsession			\
		%{_sysconfdir}/X11/gdm/gdm.conf
  do
	DN=`dirname $file`
	BN=`basename $file`
	if [ -f $DN/.$BN.orig ]; then
		mv -f $DN/.$BN.orig $file
	# support older schema
	elif [ -f $file.mille_xterm_saved ]; then
		mv -f $file.mille_xterm_saved $file
	fi
  done
  mv %{_datadir}/apps/ksmserver/pics/shutdownkonq.png.old \
    %{_datadir}/apps/ksmserver/pics/shutdownkonq.png
  mv %{_datadir}/doc/HTML/index.html.old %{_datadir}/doc/HTML/index.html
  mv %{_sysconfdir}/kde/.old/* /etc/kde
  mv %{_datadir}/apps/kdesktop/DesktopLinks/.device.desktop \
        %{_datadir}/apps/kdesktop/DesktopLinks/device.desktop
  for i in krandrinithack krandrtray; do
    mv %{_bindir}/$i.old %{_bindir}/$i 2>/dev/null
  done
fi


%files -f INSTALLED_FILES
%defattr(-,root,root,-)
%doc contrib README AUTHORS Changelog COPYING INSTALL 
%dir %{_sysconfdir}/mille-xterm/
%{_sysconfdir}/mille-xterm
%{_sysconfdir}/X11/gdm
%{_initrddir}/xtermesd
%{_sysconfdir}/X11/xsetup.d/*

%{_bindir}/*runlocal
%{_bindir}/mille-xterm-menus

%{_datadir}/apps/ksplash/Themes/*
%{_datadir}/autostart/*
%{_datadir}/gdm/themes/*
%{_datadir}/icons/*

%{_sysconfdir}/custom
/var/www/html/*

%{_sysconfdir}/kde-profile/mille-xterm-default/*
%{_sysconfdir}/kde-profile/mille-xterm-default/.kdeprofile
%config(noreplace) %{_sysconfdir}/kde-user-profile
%config(noreplace) %{_sysconfdir}/kderc
%{_sysconfdir}/menu/disable_mdk_customization



%changelog
* Fri Dec 21 2007 Olivier Blin <oblin@mandriva.com> 1.0-0.2137.3mdv2009.0
+ Revision: 136579
- restore BuildRoot

  + Thierry Vignaud <tvignaud@mandriva.com>
    - kill re-definition of %%buildroot on Pixel's request

* Fri Aug 17 2007 Adam Williamson <awilliamson@mandriva.com> 1.0-0.2137.3mdv2008.0
+ Revision: 65200
- don't own /var/www/html
- use Fedora license policy
- drop xfs dependency


* Thu Feb 08 2007 Oden Eriksson <oeriksson@mandriva.com> 1.0-0.2137.2mdv2007.0
+ Revision: 117755
- Import mille-xterm-appserver

* Fri Jan 26 2007 Mikael Andersson <mikael.andersson@envitory.se> 1.0-0.2137.2mdk
- Removed kdeedu dependency

* Fri Sep 29 2006 Oden Eriksson <oeriksson@mandriva.com> 1.0-0.2137.1mdk
- initial Mandriva package (mille-xterm import)