LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File kiwi-image-livecd-kde.spec of Package kiwi-image-livecd-kde.i586 (Project openSUSE:12.1:Live)

#
# spec file for package kiwi-image-livecd-kde (Version 11.1)
#
# Copyright (c) 2008 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/
#

# needsrootforbuild
# needsbinariesforbuild


Name:           kiwi-image-livecd-kde
Url:            http://kiwi.berlios.de/
BuildRequires:  createrepo kiwi kiwi-desc-isoboot package-lists-openSUSE-KDE-cd
BuildRequires:  checkmedia fdupes kiwi-desc-oemboot kiwi-tools squashfs
BuildRequires:  pm-utils yast2-live-installer libcdio-utils unionfs-fuse
BuildRequires:  bootsplash bootsplash-branding gfxboot-devel
BuildRequires:  yast2-firstboot kiwi-config-openSUSE yast2-live-installer
BuildRequires:  openSUSE-release-livecd-kde IlmBase
BuildRequires:  openSUSE-release-livecd-kde clicfs ImageMagick bootchart
#!BuildIgnore: kvm-kmp
#!BuildIgnore: openSUSE-release-ftp
#!BuildIgnore: build-compare
#USB #!BuildIgnore:  openSUSE-release-livecd-kde
#USB #!BuildIgnore:  openSUSE-release-livecd-gnome
# the following are listed as needed without a way for me to track it
# without solving and I have no idea how to do that automatically.
# simply remove them and try to build - kiwi/zypper will then complain
BuildRequires:  fribidi
BuildRequires:  boo gfxboot
BuildRequires:  ghostscript-fonts-std ghostscript-library
Summary:        KDE live CD
Version:        12.1
Release:        1
Requires:       cliclists-kde = %{version}-%{release}
Group:          System/Boot
License:        BSD 3-Clause
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
ExcludeArch:    ia64 ppc64 s390x s390 ppc
%ifarch %ix86
BuildArch:      i686  
%endif
%define build_usb 0
# do not compress the ISO - takes ages 
%define _binary_payload w.ufdio

%description
The package contains a huge ISO

%package promo
Group:          System/Boot
License:        BSD 3-Clause
Summary:        KDE live CD

%description promo
The package contains a huge ISO

%prep
%setup -T -c

%build
desktop=`echo %name | cut -d- -f4`
type=`echo %name | cut -d- -f3`
config=$type-$desktop

rm -rf tmp out
mkdir tmp out
rm -rf /home/rpmdir
mkdir -p /home/rpmdir/rpms
createrepo /.build.binaries/
mount -obind /.build.binaries/ /home/rpmdir/rpms
cp -a /usr/share/openSUSE-kiwi/$config config
#kiwitype=oemboot
#if test $type = livecd; then
#  kiwitype=isoboot
#fi
#cp -rL /usr/share/kiwi/image/$kiwitype/suse-%{version} config/mysub
#patch config/mysub/config.xml $patch
#kiwi --createhash config/mysub
#sed -i -e "s,$kiwitype/suse-%{version},$PWD/config/mysub," config/config.xml
kiwi --logfile terminal --root $PWD/tmp --prepare config --ignore-repos --add-repo /home/rpmdir/rpms --add-repotype rpm-md
grep '<package ' /usr/share/openSUSE-kiwi/$config/config.xml  | grep -v package-lists-openSUSE | cut '-d"' -f2  > wanted.list
cat /usr/share/suse/packages/*_cd.*.list >> wanted.list
sort -u -o wanted.list wanted.list
rpm -r $PWD/tmp -qa | grep -v gpg-pubkey | sed -e 's,-[^-]*-[^-]*$,,' | sort -u > installed.list
diff -u wanted.list installed.list 
cat tmp/var/log/config.log
if grep -q FAILED tmp/var/log/config.log; then
   exit 1
fi

if test $type = livecd; then
  export MKCLICFS_COMPRESSION=0
  kiwi --logfile terminal --create $PWD/tmp -d $PWD/out --isocheck  --ignore-repos --add-repo /home/rpmdir/rpms --add-repotype rpm-md
else
  kiwi --logfile terminal --create $PWD/tmp -d $PWD/out --type oem  --ignore-repos --add-repo /home/rpmdir/rpms --add-repotype rpm-md
fi

umount -f /home/rpmdir/rpms
umount -f tmp/base-system/home/rpmdir || true

%install
desktop=`echo %name | cut -d- -f4`
type=`echo %name | cut -d- -f3`

cd out
if test $desktop = gnome; then
  string=GNOME
  label="openSUSE_Live_GNOME"
else
  string=KDE4
  label="openSUSE_Live_KDE"
fi

arch=%{_arch}
if test "$arch" = i386; then
  arch=i686
fi

if test $type = livecd; then
  file=`ls -1 *.iso`
  filelist=`iso-info  --no-header -f $file | grep " /" | cut -b11- | LC_ALL=C sort -r `
  
  mkdir %{buildroot}/CD1
  for i in $filelist; do
    mkdir -p %{buildroot}/CD1/`dirname $i` || true
    iso-read -i $file -e $i -o %{buildroot}/CD1/"$i" || true
  done

  pushd %{buildroot}/CD1/
  if test $desktop = gnome; then
     cp config.isoclient config.$desktop.isoclient
  fi
  sed -i -e "s,label openSUSE.*,label $label," boot/*/loader/isolinux.cfg
  sed -i -e "s,label Failsafe.*,label linux," boot/*/loader/isolinux.cfg
  sed -i -e "s,showopts ide=nodma.*,liveinstall showopts," boot/*/loader/isolinux.cfg
  sed -i -e "s,label Hard-Disk,label harddisk," boot/*/loader/isolinux.cfg
  sed -i -e "s,default open.*,default $label," boot/*/loader/isolinux.cfg
  sed -i -e "s,openSUSE[^ ]*,$label," boot/*/loader/isolinux.msg
  sed -i -e "s,splash=silent,splash=silent quiet preloadlog=/dev/null," boot/*/loader/isolinux.cfg
  sed -i -e 's,key.F4=$,key.F4=kernelopts,' boot/*/loader/gfxboot.cfg

  file=`ls -1 openSUSE-*-read-only*`
  
  bootd=$(ls -1d boot/*/loader)
  cp boot/*/loader/isolinux.cfg syslinux.cfg
  sed -i -e "s,kernel linux,kernel $bootd/linux," syslinux.cfg
  sed -i -e "s,initrd=initrd,initrd=$bootd/initrd," syslinux.cfg
  sed -i -e "s,timeout *200,timeout 5," syslinux.cfg
  # copyright matz
  sed -ne ':ss;/^label media/{:s;n;/^ /b s;b ss};p' syslinux.cfg > t && mv t syslinux.cfg
  
resize2min ()
{
  # this happens to always exit 1
  /sbin/fsck.ext4 -f -y fsdata.ext3 || true
  bcount=$(LC_ALL=C /sbin/resize2fs -P fsdata.ext3 2> /dev/null | grep '^Estimated minimum' | sed -e 's,.*: *,,')
  resize2fs fsdata.ext3 $bcount
}

  /usr/bin/unclicfs $file
  mkdir chroot
  mount -o loop,rw fsdata.ext3 chroot
  chroot chroot bash -c 'zcat /var/cache/preload/trace.gz | /usr/bin/prepare_preload > /var/cache/preload/prepared' || true
  umount chroot
  rmdir chroot
  # convert to ext4
  /sbin/tune2fs -O extents,huge_file,flex_bg,uninit_bg,dir_nlink,extra_isize fsdata.ext3
 
  resize2min 
  resize2min
  resize2min
  /usr/bin/mkclicfs -c 0 fsdata.ext3 $file
  rm fsdata.ext3

  popd
  echo /CD1 > ../fileslist
  if test $desktop = gnome; then
    echo "%exclude /CD1/config.gnome.isoclient" >> ../fileslist
  fi
else
  file=`ls -1 *.raw`
  mkdir -p %{buildroot}/usr/share/kiwi/output
  gzip -c $file > %{buildroot}/usr/share/kiwi/output/openSUSE-%version-%release-$string-USB-$arch.raw.gz
  echo /usr/share/kiwi > ../fileslist
fi

%files -f fileslist
%defattr(-, root, root)

%if "%name" == "kiwi-image-livecd-gnome"
%files promo
%defattr(-, root, root)
%dir /CD1
/CD1/config.gnome.isoclient
%endif

%changelog