Tutorials

Wednesday, October 31, 2012

Fedora 17 - Custom Spins, Continued

This is a continuation of my previous post regarding creating custom live media.  The previous post dealt with specifying software only from Fedora's repositories.  This installment furthers the live media effort to include software from third party repositories, as well as some custom tweaking

Note that if you choose to distribute this media, you should be aware of any licensing issues from the third party repositories.

Let's get on with it!

Create Your Kickstart File


Next, create your kickstart file.  I'll call mine giltner-livedvd-kde-multimedia.ks

~/spin/giltner-livedvd-kde-multimedia.ks


# giltner-livedvd-kde-multimedia.ks
#
# Description:
# - Fedora Livecd Spin with the K Desktop Environment (KDE)
#
# Maintainer(s):
# - Giltner Tech <giltnertech@gmail.com>


%include fedora-livecd-kde.ks


repo --name="rpmfusion-nonfree" --mirrorlist=http://mirrors.rpmfusion.org/mirrorlist?repo=nonfree-fedora-$releasever&arch=$basearch
repo --name="rpmfusion-nonfree-updates" --mirrorlist=http://mirrors.rpmfusion.org/mirrorlist?repo=nonfree-fedora-updates-released-$releasever&arch=$basearch
repo --name="rpmfusion-free" --mirrorlist=http://mirrors.rpmfusion.org/mirrorlist?repo=free-fedora-$releasever&arch=$basearch
repo --name="rpmfusion-free-updates" --mirrorlist=http://mirrors.rpmfusion.org/mirrorlist?repo=free-fedora-updates-released-$releasever&arch=$basearch

repo --name=local --baseurl=file:///home/giltner/spin/repo
repo --name="adobe-linux-i686" --baseurl=http://linuxdownload.adobe.com/linux/i386/

#repo --name="fedora-chromium-stable" --baseurl=http://repos.fedorapeople.org/repos/spot/chromium-stable/fedora-$releasever/$basearch/
#repo --name="virtualbox" --baseurl=http://download.virtualbox.org/virtualbox/rpm/fedora/$releasever/$basearch
#repo --name="livna" --mirrorlist=http://rpm.livna.org/mirrorlist




%packages

#######################################
# Repo RPMs
# Installs repositories on the target system from the repos listed above
#######################################

rpmfusion-free-release
rpmfusion-nonfree-release
adobe-release-i386
#livna-release



#######################################
# Software from "local" repo, i.e., --basefile=file:///path/to/rpm/files
# This is a great spot to put your own RPM files, or downloaded RPM files
#######################################

autoplus
libdvdcss2
opera


#######################################
# Adobe - http://fedoraproject.org/wiki/Flash
#######################################

AdobeReader_enu
flash-plugin



#######################################
# Livna - The home of libdvdcss, that which allows DVD playback
# This repo suffers intermittent troubles. Install from local repo instead
#######################################

#libdvdcss




#######################################
# RPM Fusion
# Install multimed software and codecs
#######################################

gstreamer-plugins-ugly
gstreamer-plugins-bad
gstreamer-plugins-bad-extras
gstreamer-ffmpeg
totem
totem-mozplugin
totem-pl-parser
####totem-xine -- cannot find for some reason.
mozplugger
gecko-mediaplayer
xmms
xmms-faad2
libmad
libid3tag
libdvdread
libdvdnav
libquicktime
vlc
ffmpeg
xine-ui
imagination
dvdrip
k9copy
dvd95


#######################################
# Prepare for nVidia driver compilation
# Install now, to save downloading later
#######################################

gcc
binutils
rpm-build


%end




%post --nochroot

#######################################
# MPlayer Multimedia Codecs
# Additional codecs. You can never have too many!
#######################################

wget http://www.mplayerhq.hu/MPlayer/releases/codecs/all-20110131.tar.bz2
tar -jxvf all-20110131.tar.bz2
mkdir -p $INSTALL_ROOT/usr/local/lib/codecs
cp all-20110131/* $INSTALL_ROOT/usr/local/lib/codecs
ln -sf $INSTALL_ROOT/usr/local/lib/codecs $INSTALL_ROOT/usr/lib/codecs && ln -sf $INSTALL_ROOT/usr/local/lib/codecs $INSTALL_ROOT/usr/local/lib/win32 && ln -sf $INSTALL_ROOT/usr/local/lib/codecs $INSTALL_ROOT/usr/lib/win32
rm -f all-20100303.tar.bz2
rm -rf all-20100303




#######################################
# nVidia Driver Scripts
# Handy scripts to install drivers after OS installation
#######################################

mkdir $INSTALL_ROOT/root/GiltnerTech

cat << --nVidia1-- >> $INSTALL_ROOT/root/GiltnerTech/nVidia_driver_1
#!/bin/bash
clear
echo The nVidia driver scripts will install the proprietary nVidia drivers.
echo
echo This first script will update selinux, and install the PAE kernel.
echo
echo Press Enter to continue, or Ctlr-C to exit.
read $Dummy
yum -y update selinux-policy\*
yum -y install kernel-PAE
echo You must now reboot your system to activate the new kernel
echo before continuing with the next stage.
--nVidia1--

cat << --nVidia2-- >> $INSTALL_ROOT/root/GiltnerTech/nVidia_driver_2
#!/bin/bash
clear
echo The nVidia driver scripts will install the proprietary nVidia drivers.
echo
echo This second script will install kernel headers, nVidia drivers, backup
echo the existing initramfs image, and create a new initram image.
echo
echo Press Enter to continue, or Ctlr-C to exit.
read $Dummy

yum install kernel-PAE-devel akmod-nvidia xorg-x11-drv-nvidia-libs.i686
mv /boot/initramfs-$(uname -r).img /boot/initramfs-$(uname -r)-nouveau.img
dracut /boot/initramfs-$(uname -r).img $(uname -r)
echo You must now reboot your system.  The driver should be installed and working.
--nVidia2--

chmod 755 $INSTALL_ROOT/root/GiltnerTech/nVidia_driver_1
chmod 755 $INSTALL_ROOT/root/GiltnerTech/nVidia_driver_2



#######################################
# Virtualbox
# Need to install VirtualBox after OS is installed on target
#######################################


cat << --virtualBox-- >> $INSTALL_ROOT/root/GiltnerTech/installVirtualbox_4.1
#!/bin/bash
echo This script will download the VirtualBox repo file, GPG key, and install VirtualBox.
echo
echo Press Enter to continue, or Ctlr-C to exit.
read $Dummy

rpm --import  http://download.virtualbox.org/virtualbox/debian/oracle_vbox.asc
wget http://download.virtualbox.org/virtualbox/rpm/fedora/virtualbox.repo
mv virtualbox.repo /etc/yum.repos.d/
chmod 644 /etc/yum.repos.d/virtualbox.repo
echo Repository installed.  Continuing with installation.
yum -y install VirtualBox-4.1
--virtualBox--

chmod 755 $INSTALL_ROOT/root/GiltnerTech/installVirtualbox_4.1





#######################################
# Chromium Fedora People Repo
#######################################


cat << --fedoraChromium-- >> $INSTALL_ROOT/root/GiltnerTech/installChromium
#!/bin/bash
echo This script will install the FedoraPeople Chromium repo, and install the Chromium browser
echo
echo Press Enter to continue, or Ctlr-C to exit.
read $Dummy

wget http://repos.fedorapeople.org/repos/spot/chromium-stable/fedora-chromium-stable.repo
mv fedora-chromium-stable.repo /etc/yum.repos.d/
chmod 644 /etc/yum.repos.d/fedora-chromium-stable.repo
echo Repository installed.  Continuing with installation.
yum -y install chromium.i686 chromium-ffmpegsumo.i686

--fedoraChromium--

chmod 755 $INSTALL_ROOT/root/GiltnerTech/installChromium




#######################################
# Google Earth Repo
#######################################

cat << --googleEarth-- >> $INSTALL_ROOT/root/GiltnerTech/installGoogleEarth
#!/bin/bash
echo This script will install the Google signing key, Earth repo, and install Earth with dependencies
echo
echo Press Enter to continue, or Ctlr-C to exit.
read $Dummy

rpm --import https://dl-ssl.google.com/linux/linux_signing_key.pub

cat << --googleEarthRepo-- >> /etc/yum.repos.d/google-earth.repo
[google-earth]
name=google-earth
baseurl=http://dl.google.com/linux/earth/rpm/stable/i386
enabled=1
gpgcheck=1
--googleEarthRepo--

chmod 644 /etc/yum.repos.d/google-earth.repo
echo Repository installed.  Continuing with installation.
yum -y install google-earth-stable mesa-libGL.i686 bitstream-vera-fonts-common libxml2.i686 gtk2.i686 libSM.i686 qt-x11 redhat-lsb-desktop.i686 redhat-lsb-printing.i686 redhat-lsb.i686

--googleEarth--

chmod 755 $INSTALL_ROOT/root/GiltnerTech/installGoogleEarth





#######################################
# Google Music Manager Repo
#######################################


cat << --googleMusic-- >> $INSTALL_ROOT/root/GiltnerTech/installGoogleMusic
#!/bin/bash
echo This script will install the Google signing key, Music repo, and install Music Manager
echo
echo Press Enter to continue, or Ctlr-C to exit.
read $Dummy

rpm --import https://dl-ssl.google.com/linux/linux_signing_key.pub

cat << --googleMusicRepo-- >> /etc/yum.repos.d/google-musicmanager.repo
[google-musicmanager]
name=google-musicmanager
baseurl=http://dl.google.com/linux/musicmanager/rpm/stable/i386
enabled=1
gpgcheck=1
--googleMusicRepo--

chmod 644 /etc/yum.repos.d/google-musicmanager.repo
echo Repository installed.  Continuing with installation.
yum -y install google-musicmanager

--googleMusic--

chmod 755 $INSTALL_ROOT/root/GiltnerTech/installGoogleMusic


%end





Place any RPM files you wish to include inside of the repo folder.  In my example above, I placed Autoplus, libdvdcss2, and Opera RPM files inside my local folder.

Now, let's build the image

As root, do

setenforce 0
createrepo /home/giltner/spin/repo
livecd-creator --config=/home/giltner/spin/giltner-livedvd-kde-multimedia.ks.ks --fslabel=GiltnerMultimedia --cache=/var/cache/live 



Let's take a look at the above example one section at a time.

The first several lines are comments.  You can freely modify this to suit your needs.

%include
This line pulls in all data from the specified file.  Multiple include declarations are acceptable.  The above kickstart basically adds multimedia support on top of the Fedora KDE spin.

I happen to have a separate kickstart file that adds additional software from the official Fedora repos, called giltner-livedvd-kde.ks.  If I want to combine the two, I can change the %include line to point to my other kickstart file, which includes fedora-livecd-kde.ks.  This keeps things separate.

clearpart and part
These lines clear the partition table of the media, and resets the root partition size to that of a DVD.  It throws an error when creating the image, but appears to work just fine.


repo
The repo lines add a repository that will be used to create the media.  Note that this does not install the repository on the live media (thus, installed system).  This merely tells livecd-tools where to pull software from for the installation.

Note the repo line named "local".  This points to a local directory from which to install RPM files from.  Here, you can create your own RPM's, or download them from the Internet and place them here manually.


packages
This section is rather straightforward.  The only thing I did here is group software according to which repo they were installed from.

post --nochroot
This section issues commands just as you would at a terminal, and does so inside the live image, and gets transferred to the build system.  Customizations can be made here to the target system, for example, by using sed to edit existing files.

The first thing I've done in my example is to download and install additional multimedia codecs. 

The rest of this section creates bash scripts, inside a folder called GiltnerTech in root's home, to install additional software after the target system is installed.

Creation of the bash scripts is fairly simple.  Take for example the following lines.


cat << --fileExample-- >> /root/test.sh
#!/bin/bash
echo Hello World!
--fileExample--

chmod 755 $INSTALL_ROOT/root/test.sh



What happens here is cat places the everything that follows the cat line, up to but not including the --fileExample-- label, into a file called /root/test.sh.  Then, the file is marked as executable.

The file created will look like this:

/root/test.sh

#!/bin/bash
echo Hello World!



This will create a nicely loaded KDE DVD with plenty of multimedia add-ons, repos configured, and some custom scripts to install more software.

More Info
Fedora, How to create and use a Live CD



4 comments:

  1. primevideo.com/mytv : Easily Enter Activation Code

    How about we talk about the Amazon primevideo.com/mytv. In the event that you have a substantial Amazon prime video account with a functioning membership this post will manage you on the most proficient method to enter prime video enactment code on primevideo.com/mytv enter code. com primevideo mytv visit given link

    ReplyDelete
  2. 파칭코사이트인포 파칭코사이트 I’m also commenting to let you know what a superb encounter my cousin’s princess found reading through your site. She came to find several issues, not to mention what it’s like to possess a very effective giving spirit to get folks clearly fully understand certain tricky subject areas. You truly did more than my desires. I appreciate you for rendering those informative, dependable, edifying and in addition easy thoughts on your topic to Kate.

    ReplyDelete
  3. I’m also commenting to let you know what a superb encounter my cousin’s princess found reading through your site. She came to find several issues, not to mention what it’s like to possess a very effective giving spirit to get folks clearly fully understand certain tricky subject areas. You truly did more than my desires. I appreciate you for rendering those informative, dependable, edifying and in addition easy thoughts on your topic to Kate.블랙잭사이트

    ReplyDelete
  4. 스포츠토토링크 I’m also commenting to let you know what a superb encounter my cousin’s princess found reading through your site. She came to find several issues, not to mention what it’s like to possess a very effective giving spirit to get folks clearly fully understand certain tricky subject areas. You truly did more than my desires. I appreciate you for rendering those informative, dependable, edifying and in addition easy thoughts on your topic to Kate.

    ReplyDelete