• Sign in and stuff

Linux-Live.org

Trying to get Linux Live from Linux-Live.org work

#!/bin/bash
#
# run this script to create a LiveCD in /tmp/live_data_1234
#
# Author: Tomas M. <http://www.linux-live.org&gt;

export PATH=.:./tools:../tools:/usr/sbin:/usr/bin:/sbin:/bin:/

CHANGEDIR=$(dirname $(readlink -f $0))
echo “Changing current directory to $CHANGEDIR”
cd $CHANGEDIR

. liblinuxlive || exit 1
. ./.config || exit 1

# only root can continue, because only root can read all files from your system
allow_only_root

# live CD name
echo -ne “Name of your live distro [hit enter for $LIVECDNAME]: ”
read NEWLIVECDNAME
if [ “$NEWLIVECDNAME” != “” ]; then LIVECDNAME=$NEWLIVECDNAME; fi
LIVECDNAME=$(echo $LIVECDNAME | tr -d ‘ ‘)

. ./install
if [ “$ROOT” -a “$ROOT” != “/” ]; then
. ./install $ROOT
fi

# search for kernel
VMLINUZ=$ROOT/boot/vmlinuz
if [ -L “$VMLINUZ” ]; then VMLINUZ=$(readlink -f $VMLINUZ); fi
echo -ne “Enter path for the kernel you’d like to use [hit enter for $VMLINUZ]: ”
read NEWKERNEL
if [ “$NEWKERNEL” != “” ]; then VMLINUZ=”$NEWKERNEL”; fi
if [ “$(ls $VMLINUZ 2>>$DEBUG)” = “” ]; then echo “cannot find $VMLINUZ”; exit 1; fi

header “Creating LiveCD from your Linux”
echo “some debug information can be found in $DEBUG”

mkdir -p $CDDATA/$LIVECDNAME/{base,modules,optional,rootcopy,tools}

echo “copying cd-root to $CDDATA, using kernel from $VMLINUZ”
cp -R cd-root/boot $CDDATA
for i in isolinux syslinux; do
cat cd-root/boot/$i/$i.cfg | sed -r “s/LABEL linux/LABEL $LIVECDNAME/” | sed -r “s/Run linux/Run $LIVECDNAME/” > $CDDATA/boot/$i/$i.cfg
done
mv $CDDATA/boot/dos/linux.bat $CDDATA/boot/dos/${LIVECDNAME:0:8}.bat
cat cd-root/boot/dos/readme.txt | sed -r “s/LINUX.BAT/”${LIVECDNAME:0:8}.bat”/” > $CDDATA/boot/dos/readme.txt

mkdir -p $CDDATA/$LIVECDNAME
cp -R cd-root/linux/* $CDDATA/$LIVECDNAME
cp tools/* $CDDATA/$LIVECDNAME/tools
cp -R DOC/LICENSE $CDDATA/$LIVECDNAME
cp $VMLINUZ $CDDATA/boot/vmlinuz

echo “creating initrd image…”
echo “Using kernel modules from $ROOT/$LMK”
cd initrd
./initrd_create $LIVECDNAME
if [ “$?” -ne 0 ]; then exit; fi
cd ..

cp initrd/initrd.gz $CDDATA/boot/initrd.gz
rm initrd/initrd.gz

echo “creating compressed images…”

for dir in $MKMOD; do
if [ -d $ROOT/$dir ]; then
echo “base/$dir.lzm …”
echo -ne > exclude.txt
for i in $EXCLUDE; do
part=$(echo “x/$i” | tr -s / | sed -r “s:x/[^/]+/::”)
if [ -e “$ROOT/$dir/$part” ]; then echo “$ROOT/$dir/$part” >> exclude.txt; fi
done
cat exclude.txt
create_module $ROOT/$dir $CDDATA/$LIVECDNAME/base/$dir.lzm -keep-as-directory -ef exclude.txt
if [ $? -ne 0 ]; then exit; fi
rm exclude.txt
echo
fi
done

cd $CDDATA/$LIVECDNAME
echo “——–done———-”
echo
echo “* run $CDDATA/$LIVECDNAME/make_iso.bat to create ISO image”
echo “* or copy content of $CDDATA to your USB device”
echo “and run ./boot/bootinst.sh (from the device!) to setup boot sector”
echo
echo “Now press Enter…”
read junk

I’m confused from the very beginning.  Why do we need to

CHANGEDIR=$(dirname $(readlink -f $0))
echo “Changing current directory to $CHANGEDIR”
cd $CHANGEDIR

The script ends up erroring at

echo “Using kernel modules from $ROOT/$LMK”

I’ll have to look for a good wordpress module for code where there are line numbers…

bash script for getting user profiles ready to go

This script is to be run as root…but the 2nd line (1st functional line) doesn’t work because root has nothing in .gconf

#!/bin/bash

cp -R ~/.gconf /etc/skel/

echo “<?xml version=\”1.0\”?>
<gconf>
<entry name=\”frequency_get_upgrades\” mtime=\”1251122031\” type=\”int\” value=\”0\”/>
<entry name=\”auto_update\” mtime=\”1251122029\” type=\”string\”>
<stringvalue>security</stringvalue>
</entry>
<entry name=\”frequency_get_updates\” mtime=\”1251222859\” type=\”int\” value=\”86400\”/>
</gconf>” >> /etc/skel/.gconf/apps/gnome-packagekit/update-icon/%gconf.xml

echo “Enter Username (person getting computer)”
read userftw

useradd $userftw
echo password | passwd –stdin $userftw

useradd douglasawh

echo “$userftw ALL=(ALL) ALL” >> /etc/sudoers
echo ‘douglasawh ALL=(ALL) ALL’ >> /etc/sudoers

yum -y remove evolution transmission gnome-disk-utility

yum -y install tsclient gconf-editor

sh vpnsetup.sh

echo “\nIf you have the time, run yum -y upgrade. kthxbai”

This is slightly different than the one I’m using just because it’s probably not the safest thing in the world to have all the usernames out of there.

We may add more to the script later, but right now we don’t have a lot we want to do. All these users need to be able to do is remote desktop, but we also want to make sure they are getting security updates and some other minor things that should be apparent in the script.

All of this would be easier if we were still using UCK or reconstructor in ubuntu, but due to Spacewalk, we are moving to Fedora.