Remaster Script

If you have any suggestions or ideas about improving Salix, here's the place to post them.
Post Reply
aryr100
Posts: 7
Joined: 21. Jun 2010, 14:22

Remaster Script

Post by aryr100 »

I found this .sh tried to edit it
Getting some errors with my edit package rebuild not working
gzip: stdin: not in gzip format
tar: Child returned status 1
tar: Exiting with failure status due to previous errors

Code: Select all

#!/bin/bash
# Script name: rollyourown.sh
# Parts of script is from Mr. Sherman and
# others from the Slackware team.  Thank you all for such great work.
# I use a similar version to this, but not exact.  This should be easy to change
# since there are variables.  FM = file manager and EDITOR is text editor (duh!).
clear
FM="dolphin"
MENUPWD=$0
EDITOR="KWrite"
WORKDIR="/usr/src/mylinux" # Don't include trailing slash
VERSION="Kslacking64 13.1"
ISONAME="Kslacking64.iso"
BROWSER="firefox"
CDDEVICE="/dev/hdc"
#----------------------
#Function Declarations
#----------------------

unzipinitrd()
{
cd $WORKDIR/initfiles
mkdir $WORKDIR/initfiles/initrd_tmp 2>/dev/null && echo "Created Temporary Initrd Directory."
cd $WORKDIR/initfiles/initrd_tmp
echo "Removing all old files..."
rm * -rf
echo "Unzipping initrd.img using CPIO"
zcat $WORKDIR/isofiles/isolinux/initrd.img | cpio -i
}

zipinitrd()
{
cd $WORKDIR/initfiles/initrd_tmp
echo "Creating initrd image."
find . | cpio -o -H newc > ../initrd_new.img
echo "Compressing new image with gzip."
gzip -9 $WORKDIR/initfiles/initrd_new.img
echo "Moving file."
mv $WORKDIR/initfiles/initrd_new.img.gz $WORKDIR/initfiles/initrd.img
echo "Removing unnecessary files."
echo "Copying initrd to isolinux under the iso folder."
cp $WORKDIR/initfiles/initrd.img $WORKDIR/isofiles/isolinux -f
echo "Setting necessary permissions (777) to initrd.img under isolinux."
chmod 777 $WORKDIR/isofiles/isolinux/initrd.img
}

makeiso()
{
cd $WORKDIR/isofiles
mkdir $WORKDIR/iso 2>/dev/null
mkisofs -o $WORKDIR/iso/$ISONAME -R -J -V "My $VERSION" -hide-rr-moved -v -d -N -no-emul-boot -boot-load-size 4 -boot-info-table -sort isolinux/iso.sort -b isolinux/isolinux.bin -c isolinux/isolinux.boot -A "My $VERSION Install" .
}

Pause()
{
echo
echo -n "Done... Hit Enter to Continue!"
read
}

InitrdMenu()
{
clear
echo "[1] Edit 'rc.S' (BootCD Startup script)"
echo "[2] Edit 'setup' file"
echo "[3] Open setup directory"
echo
echo "[Q] Quit to Main Menu"
echo -n "Selection: "
read initrdchoice
case "$initrdchoice" in
1) $EDITOR $WORKDIR/initfiles/initrd_tmp/etc/rc.d/rc.S
InitrdMenu
;;
2) $EDITOR $WORKDIR/initfiles/initrd_tmp/usr/lib/setup/setup
InitrdMenu
;;
3) $FM $WORKDIR/initfiles/initrd_tmp/usr/lib/setup/
InitrdMenu
;;
4) $EDITOR $WORKDIR/initfiles/initrd_tmp/etc/rc.d/rc.S
;;
esac
}

PackageSearch()
{
clear
echo -n "Package to search for (any part of string)"
read searchstring
SearchList=($(find $WORKDIR/isofiles/slackware64/ -name *$searchstring*.txz))
select SEARCHING in ${SearchList[*]} Quit
do
case "$SEARCHING" in
"") echo Hit Enter!
continue
;;
Quit) break
;;
*) tar xvzf $SEARCHING -C $WORKDIR/packagework
   $FM $WORKDIR/packagework
   echo -n "Do you wish to repack now? (y/N) "
   read packageduh
case $packageduh in
[Yy]*) cd $WORKDIR/packagework
tar cvzf $SEARCHING *
rm $WORKDIR/packagework/* -rf
echo "Repackaged $SEARCHING...Complete!"
Pause
break
;;
esac
    ;;
esac
done
}

PackageWork()
{
clear
DirectoryList=($(cd $WORKDIR/isofiles/slackware64/ && find . -name *.txz|awk -F / '{print $2}'|sort|uniq))
select CHOICE in ${DirectoryList[*]} Quit
do
case "$CHOICE" in
"" ) echo Hit Enter!
continue
;;
Quit) break
;;
*) select CHOSEN in `find $WORKDIR/isofiles/slackware64/$CHOICE/ -name *.txz` Quit
do
case "$CHOSEN" in
"" ) echo Hit Enter!
continue
;;
Quit) echo "Press enter to get menu" && break && echo "Jeff"
;;
*) tar xvzf $CHOSEN -C $WORKDIR/packagework
   $FM $WORKDIR/packagework
   echo -n "Do you wish to repack now? (y/N) "
   read packaging
if $packaging == [Yy]*; then
cd $WORKDIR/packagework
tar cvzf $CHOSEN *
rm $WORKDIR/packagework/* -rf
fi
    ;;
esac
done
;;
esac
done

}

BurnISO()
{
cdrecord -dev=$CDDEVICE $WORKDIR/iso/$ISONAME
}

# --------------------------
# Start of Menu
# --------------------------
until [ "1" = "0" ]
do
clear
echo "--INITRD Section--"
echo "[1] Unzip Initrd (Ramdisk files after BOOT)"
echo "[2] Edit Initrd files"
echo "[3] Zip Initrd (places back in isofiles folder)"
echo "[4] INITRD Submenu"
echo
echo "--Packages Section--"
echo "[5] Packages Directory"
echo "[6] Packages Editing Menu"
echo "[7] Search for a Package to Edit"
echo
echo "--Creation Section--"
echo "[8] Make ISO (places in $WORKDIR/iso/ folder)"
echo "[9] Burn ISO in folder (not implemented yet)"
echo
echo "--Other Section--"
echo "[E] Edit this Menu"
echo "[I] Initialize Directories (start here if necessary)"
echo "[W] What needs to be done before you start"
echo "[M] Manual Instructions for Rolling Your Own Distro"
echo
echo "[X] Exit"
echo
echo
echo -n "Selection: "
read chosen

case "$chosen" in
"1") unzipinitrd
Pause
;;
"2") $FM $WORKDIR/initfiles/initrd_tmp
;;
"3") zipinitrd
Pause
;;
"4") InitrdMenu
;;
"5") $FM $WORKDIR/isofiles/slackware64
;;
"6")    PackageWork
;;
"7") PackageSearch
;;
"8") makeiso
Pause
;;
"9") BurnISO
Pause
;;
[Xx]) break
;;
[Ee]) $EDITOR $MENUPWD
;;
[Ii]) mkdir $WORKDIR/isofiles -p
mkdir $WORKDIR/initfiles/initrd_tmp -p
mkdir $WORKDIR/initfiles/initrd_img
mkdir $WORKDIR/iso
mkdir $WORKDIR/packagework
Pause
;;
[Mm]) $BROWSER http://www.absolutelinux.org/help/rollyourown.html
Pause
;;
[Ww]) echo "What needs to be done."
echo "1.) Run Intialize (Selection 'I' on main menu)"
echo "2.) Copy Slackware-based Install CD files (Absolute for instance) to $WORKDIR/isofiles"
echo "3.) Edit what you want using the menu.  Initrd are the install CD boot files and setup scripts."
echo "4.) Edit what you want some more."
echo "5.) Run #8 on the menu to make an iso in $WORKDIR/iso."
echo "6.) Burn ISO to CD and use your own rolled CD."
echo "7.) Make additions/improvements to this script submit it!"
                Pause
                ;;
esac
done
exit 0
User avatar
gapan
Salix Wizard
Posts: 6241
Joined: 6. Jun 2009, 17:40

Re: Remaster Script

Post by gapan »

If you want to remaster a salix iso, just open it with isomaster, remove any packages you don't want from any of the package directories inside the salix directory (core, basic, full), add the ones you want instead and save to a new iso. That's it, simple as that.
Image
Image
Post Reply