File kiwi-config-openSUSE.spec of Package kiwi-config-openSUSE

#
# spec file for package kiwi-config-openSUSE (Version 11.2)
#
# Copyright (c) 2009 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#



Name:           kiwi-config-openSUSE
BuildRequires:  fdupes kiwi-desc-isoboot package-lists-openSUSE-all
BuildRequires:  kiwi-desc-oemboot kiwi-desc-usbboot kiwi-doc kiwi-tools
BuildRequires:  licenses skelcd-control-openSUSE skelcd-openSUSE-CD
BuildRequires:  libxslt opensuse-gnomequick_en-pdf opensuse-kdequick_en-pdf
BuildRequires:  yast2-country
Summary:        KDE live CD
Version:        11.2
Release:        16.<RELEASE3>
Group:          System/Boot
License:        BSD 3-clause (or similar)
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Source1:        COPYING
Source2:        config-hal.patch
Source3:        config.sh
Source4:        config.xml.in
Source5:        config.patch
Source6:        config-kde.patch
Source7:        config-gnome.patch
Source8:        ifcfg-eth0
Source10:       README
Source11:       correct_live_for_reboot
Source12:       correct_live_install
Source16:       boot.langset
Source17:       99-ignore-live-usb.fdi
Source19:       config-usb.patch
Source20:       geturls.xsl
Source22:       getcountrydata.ycp
Source23:       langset.sh
Source24:       boot.braille
Source25:       xdm-x11.patch
Source26:       xdm-liveinstall.patch
Source27:       SoftLocks
ExcludeArch:    ia64 ppc64 s390x s390 ppc

%description
The package contains a huge ISO



%prep
%setup -T -c

%build
kiwiversion=%version
kiwiversion=11.2 # for now
BASEDIR=$PWD
rm -rf /tmp/locale-settings/
mkdir /tmp/locale-settings/
/usr/lib/YaST2/bin/y2base %{SOURCE22} UI
pushd /tmp/locale-settings/
for i in *.UTF-8; do
  mv $i ${i/.UTF-8/}
done
popd
for config in livecd-kde livecd-gnome usb-kde usb-gnome livecd-x11 usb-x11; do
  cd $BASEDIR
  mkdir $config
  cd $config
  desktop=`echo $config | cut -d- -f2`
  type=`echo $config | cut -d- -f1`
  cdlist=/usr/share/suse/packages/"$desktop"_cd.%{_target_cpu}.list 
  if test "$desktop" = kde; then
     cdlist=/usr/share/suse/packages/kde4_cd.%{_target_cpu}.list
  fi
  test -f "$cdlist" || exit 1
  sort -u $cdlist > wanted.list
  if test $type = usb; then
    sed -i -e "s,yast2-live-installer,yast2-firstboot," wanted.list
    sed -i -e "s,release-livecd,release-usb," wanted.list
    othertype=livecd
  else
    othertype=usb
  fi
  install -m 755 %{SOURCE3} config.sh
  (sed -n -e '1,/ PACKAGES BEGIN/p' %{SOURCE4} ; cat wanted.list | while read pack; do echo '<package name="'$pack'"/>'; done; sed -n -e '/ PACKAGES END/,$p' %{SOURCE4} ) | grep -v " type:$othertype " | \
    xmllint --format - > config.xml
  if test $type = usb; then 
     sed -i -e "s,yast2-live-installer,yast2-firstboot," config.xml
  fi
  rm wanted.list
  suseversion=%{version}
  if test $type = usb; then
    sed -i -e 's,#USB ,,' config.sh
  fi
  sed -i -e "s,@CONFIG@,/usr/share/openSUSE-kiwi/$config," config.xml
  sed -i -e "s,@VERSION@,$suseversion," config.xml
  sed -i -e "s,@FLAVOR@,$config," config.xml
  %ifarch x86_64
    sed -i -e "s,@BOOTKERNEL@,desktop," config.xml
  %else
    sed -i -e "s,@BOOTKERNEL@,std," config.xml
  %endif
  mkdir config-cdroot
  cd config-cdroot
  install -m 644 /usr/share/doc/licenses/GPL-2.0.txt GPLv2.txt
  install -m 644 /usr/share/doc/licenses/gpl-3.0.txt GPLv3.txt
  tar czf ../config-cdroot.tgz *
  cd ..
  rm -rf config-cdroot
  mkdir -p root/tmp
  cd root
  install -m 644 /CD1/license.tar.gz .
  mkdir rpmkeys
  cp /CD1/gpg-pubkey* rpmkeys
  install -m 644 -D /CD1/control.xml etc/YaST2/control.xml
  /usr/bin/xsltproc %{SOURCE20} /CD1/control.xml > tmp/geturls.sh
  install -m 644 %{SOURCE5} tmp/config.patch
  if test "$desktop" = gnome; then
    cat %{SOURCE7} >> tmp/config.patch
  else
    cat %{SOURCE6} >> tmp/config.patch
  fi
  mkdir -p var/lib/zypp
  install -m 644 %{SOURCE27} var/lib/zypp/SoftLocks
  echo 0123456-7890-$desktop-$type-0123456 > var/lib/zypp/AnonymousUniqueId
  mkdir -p etc/smolt
  echo 0123456-7890-$desktop-$type-0123456 > etc/smolt/uuid
  if test $type = usb; then
    cp %{SOURCE19} tmp
    mkdir -p var/lib/YaST2
    touch var/lib/YaST2/reconfig_system
    # still needed due to a bug in yast2-installation
    touch etc/reconfig_system
    install -D -m 644 /usr/share/doc/packages/kiwi/examples/suse-$kiwiversion/suse-live-stick/root/etc/X11/xorg.conf etc/X11/xorg.conf
    touch etc/dmidecode.md5
  fi
  install -D -m 644 %{SOURCE8} etc/sysconfig/network/ifcfg-eth0
  cp -a /tmp/locale-settings/ etc/langset
  install -m 755 %{SOURCE23} etc/langset.sh
  install -D -m 755 %{SOURCE24} etc/init.d/boot.braille
  install -D -m 755 %{SOURCE16} etc/init.d/boot.langset
  install -D -m 755 %{SOURCE11} usr/bin/correct_live_for_reboot
  install -D -m 755 %{SOURCE12} usr/bin/correct_live_install
  install -D -m 644 %{SOURCE2} etc/YaST2/policy.patch
  install -m 644 %{SOURCE26} etc/YaST2/liveinstall.patch
  if test $desktop = x11; then
     cat %{SOURCE25} >> tmp/config.patch
     sed -i -e "s,NETWORKMANAGER=yes,NETWORKMANAGER=no," tmp/config.patch
  fi
  mkdir -p var/lib/zypp/
  echo livecd-$desktop > var/lib/zypp/LastDistributionFlavor
  if test $desktop = kde; then
     install -m 644 /usr/share/doc/manual/opensuse-kdequick_en-pdf/opensuse-kdequick_en.pdf tmp/
  else
     install -m 644 /usr/share/doc/manual/opensuse-gnomequick_en-pdf/opensuse-gnomequick_en.pdf tmp/
  fi
  arch=%{_target_cpu}
  plfile=/usr/share/suse/packages/$config-$arch
  if test -f $plfile; then
    mkdir -p var/cache/preload
    gzip -c $plfile > var/cache/preload/trace.gz
  fi
done

%install
mkdir -p %{buildroot}/usr/share/openSUSE-kiwi
mv * %{buildroot}/usr/share/openSUSE-kiwi
install -m 644 -D %{SOURCE1} %{buildroot}/%_docdir/%name/COPYING
install -m 644 -D %{SOURCE10} %{buildroot}/%_docdir/%name/README
%fdupes %{buildroot}/usr/share/openSUSE-kiwi

%files
%defattr(-, root, root)
%doc %_docdir/%name
/usr/share/openSUSE-kiwi

%changelog
openSUSE Build Service is sponsored by