PDA

View Full Version : kickstart config background and scrip



savagehobo
22nd April 2010, 04:03 PM
Hello,

I have been working on a school project to create a customized Fedora distrobution to boot up broken windows computers at school. I have been working on a kickstart file and have been creating images with the livecdcreator. The issue right now is that I'm trying to setup a custom background, and that a scrip I've been placing on the desktop is having the '$password" parsed out. The ks script is shown below, any suggestiongs would be helpful.




%include fedora-live-base.ks
selinux --disabled

%packages
#Don't need games
#@games
@graphical-internet
@sound-and-video
@gnome-desktop
nss-mdns
NetworkManager-vpnc
NetworkManager-openvpn
# we don't include @office so that we don't get OOo. but some nice bits
abiword
cheese

# avoid weird case where we pull in more festival stuff than we need
festival
festvox-slt-arctic-hts

# dictionaries are big
-aspell-*
-hunspell-*
-man-pages*
-words

# save some space
-gnome-user-docs
-evolution-help
-gnome-games-help
-nss_db
-isdn4k-utils
-dasher
-evince-dvi
-evince-djvu
-desktop-backgrounds-basic
-constantine-backgrounds-extras

# these pull in excessive dependencies
-ekiga
-tomboy

#Extra Tools
smartmontools
#gsmartcontrol
testdisk
lshw
lshw-gui
gparted
emacs
clamav
clamav-update
telnet

#Fix for SELINUX Disabled
/usr/sbin/lokkit

%end

%post
cat >> /etc/rc.d/init.d/livesys << EOF
# disable screensaver locking
gconftool-2 --direct --config-source=xml:readwrite:/etc/gconf/gconf.xml.defaults -s -t bool /apps/gnome-screensaver/lock_enabled false >/dev/null
gconftool-2 --direct --config-source=xml:readwrite:/etc/gconf/gconf.xml.defaults -s -t bool /desktop/gnome/lockdown/disable_lock_screen true >/dev/null

# set up timed auto-login for after 60 seconds
cat >> /etc/gdm/custom.conf << FOE
[daemon]
TimedLoginEnable=true
TimedLogin=root
TimedLoginDelay=2
FOE

# Add Desktop icon for gparted
mkdir /root/Desktop
cp /usr/share/applications/fedora-gparted.desktop /root/Desktop
chown root:root /root/Desktop/fedora-gparted.desktop



# Add Bowser Mount Script
#raw
touch /root/Desktop/mount_bowser.sh
cat >> /root/Desktop/mount_bowser.sh << FOE
mkdir /mnt/Bowser
echo "Mounting Bowser at /mnt/Bowser. Please enter the Helpdesk password:"

stty -echo
read passwd
stty echo

sudo mount -t cifs //192.168.1.1/backup /mnt/Bowser -o username=helpdesk,password=\$passwd
FOE
#endraw
chmod a+x /root/Desktop/mount_bowser.sh

# Add Bowser UnMount Script
touch /root/Desktop/unmount_bowser.sh
cat >> /root/Desktop/unmount_bowser.sh << FOE
umount /mnt/Bowser
FOE
chmod a+x /root/Desktop/unmount_bowser.sh

# Add PhotoRec Icon
touch /root/Desktop/PhotoRec.desktop
cat >> /root/Desktop/PhotoRec.desktop << FOE
#!/usr/bin/env xdg-open

[Desktop Entry]
Encoding=UTF-8
Version=1.0
Type=Application
Terminal=true
Name[en_US]=PhotoRec
Exec=/usr/sbin/photorec
Comment[en_US]=PhotoRec
Icon[en_US]=/usr/share/icons/hicolor/48x48/apps/gdu-unmountable.png
Name=PhotoRec
Comment=PhotoRec
Icon=/usr/share/icons/hicolor/48x48/apps/gdu-unmountable.png
FOE
chmod a+x /root/Desktop/PhotoRec.desktop

# But not trash and home
gconftool-2 --direct --config-source=xml:readwrite:/etc/gconf/gconf.xml.defaults -s -t bool /apps/nautilus/desktop/trash_icon_visible false >/dev/null
gconftool-2 --direct --config-source=xml:readwrite:/etc/gconf/gconf.xml.defaults -s -t bool /apps/nautilus/desktop/home_icon_visible false >/dev/null

# Turn off PackageKit-command-not-found while uninstalled
sed -i -e 's/^SoftwareSourceSearch=true/SoftwareSourceSearch=false/' /etc/PackageKit/CommandNotFound.conf

# setup cntrl-shift-enter for terminal
gconftool-2 --direct --config-source=xml:readwrite:/etc/gconf/gconf.xml.mandatory --type string --set /apps/metacity/global_keybindings/run_command_terminal '<Shift><Control>Return' >/dev/null

# Nautilus Browser Stuff
gconftool-2 -t bool -s /apps/nautilus/preferences/always_use_browser true

# Remove liveinst from Desktop
rm /root/Desktop/liveinst.desktop > /dev/null

# Setup Default Background
gconftool-2 --type string --set /desktop/gnome/background/picture_filename /usr/share/backgrounds/1280-wide.png > /dev/null

EOF

%end

%post --nochroot
mkdir -p $LIVE_ROOT/usr/share/backgrounds
cp /1280-wide.png $LIVE_ROOT/usr/share/backgrounds
%end




---------- Post added at 08:03 AM CDT ---------- Previous post was at 07:58 AM CDT ----------

Just to clairify the script that has the $password part parsed out is:

# Add Bowser Mount Script
#raw
touch /root/Desktop/mount_bowser.sh
cat >> /root/Desktop/mount_bowser.sh << FOE
mkdir /mnt/Bowser
echo "Mounting Bowser at /mnt/Bowser. Please enter the Helpdesk password:"

stty -echo
read passwd
stty echo

sudo mount -t cifs //192.168.1.1/backup /mnt/Bowser -o username=helpdesk,password=\$passwd
FOE
#endraw
chmod a+x /root/Desktop/mount_bowser.sh






and I am trying to move 1280-wide.png from the root directory on my laptop to the /usr/share/backgrounds on the live system with the lines:

%post --nochroot
mkdir -p $LIVE_ROOT/usr/share/backgrounds
cp /1280-wide.png $LIVE_ROOT/usr/share/backgrounds
%end

savagehobo
26th April 2010, 10:44 PM
As it turns out I was able to get this to work by moving the "%post --nochroot" part above the regular "%post". I also copied to a new directory and then from that directory into the final locations rather than directly into the /usr/share/backgrounds folder.



...
%post --nochroot

mkdir $INSTALL_ROOT/usr/share/extrastuff
cp /usr/share/backgrounds/1280-wide.png $INSTALL_ROOT/usr/share/extrastuff/
cp /root/Desktop/mount.sh $INSTALL_ROOT/usr/share/extrastuff/

%end

%post
...

%end