Git-Url: http://git.frugalware.org/gitweb/gitweb.cgi?p=fw-initramfs.git;a=commitdiff;h=600d6319cbbed0ae51948805991d52e79c8d3cbf
commit 600d6319cbbed0ae51948805991d52e79c8d3cbf Author: bouleetbil <bouleet...@frogdev.info> Date: Thu Nov 5 20:23:45 2009 +0100 create_usblive.sh *added script for create a liveusb diff --git a/create_usblive.sh b/create_usblive.sh new file mode 100755 index 0000000..416b5c3 --- /dev/null +++ b/create_usblive.sh @@ -0,0 +1,135 @@ +#!/bin/sh + +#GNU General Public License Version +#This program is free software; you can redistribute it and/or +#modify it under the terms of the GNU General Public License +#version 2 as published by the Free Software Foundation. +#This program is distributed in the hope that it will be useful, +#but WITHOUT ANY WARRANTY; without even the implied warranty of +#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +#GNU General Public License for more details. + +HOMESOURCE=/usr/share/fw-initramfs/ +MNTTMP=/tmp/usbkey/ +DIRTEMP=/tmp/init/ + +. $HOMESOURCE/create_functions.sh +. /etc/sysconfig/usbkey.config.sh + +##################################################################### +#check if root user +##################################################################### +checkUser + +##################################################################### +#Preparation of works dir +##################################################################### +good_msg "Erase old usb works dir" +rm -rf $MNTTMP +mkdir -p $MNTTMP + +##################################################################### +#where is the usb key ? (/dev/sdXX) +##################################################################### +if [ "$USBDEVICE" == "" ]; then + bad_msg "You should define USBDEVICE into /etc/sysconfig/usbkey.config" + exit 0 +fi + +##################################################################### +#ask for erase all +##################################################################### +dialog --backtitle "$BACK_TITLE" \ +--title "Question" \ +--yesno "Are you sure to erase $USBDEVICE ?" \ +10 40 +if [ $? -eq 1 ]; then + bad_msg "Couldn't continue ..." + exit 0 +else + warn_msg "$USBDEVICE will be erase." +fi + +##################################################################### +#umount +##################################################################### +umount -f $USBDEVICE + +##################################################################### +#format as ext3 +#for an usb key don't add some others partitions only / in ext3 ! +##################################################################### +mkfs.ext3 -f $USBDEVICE + +##################################################################### +#mount it +##################################################################### +mount $USBDEVICE $MNTTMP +LigneMtab=$(grep $MNTTMP /etc/mtab) +if [ "$LigneMtab" == "" ]; then + bad_msg "Couldn't mount $MNTTMP" + exit 0 +fi + +##################################################################### +#install the base +##################################################################### +pacman-g2 -Sy core base -r $MNTTMP --noconfirm + +##################################################################### +#configure the chroot and install grub +##################################################################### +mount -t proc none $MNTTMP/proc +mount -t sysfs none $MNTTMP/sys +mount -o bind /dev $MNTTMP/dev +cp -f /etc/fstab $MNTTMP/etc/ +cp -f /etc/mtab $MNTTMP/etc/ +cp -f /etc/resolv.conf $MNTTMP/etc/ + + +##################################################################### +#copy menu.lst for grub (add bootusb to kernel parameters) +##################################################################### +cp -f menu.lst.usbkey $MNTTMP/boot/grub/menu.lst + +##################################################################### +#Some env variable +##################################################################### +cp -f /etc/profile.d/lang.sh $MNTTMP/etc/profile.d/lang.sh +chmod +x $MNTTMP/etc/profile.d/lang.sh +cp -f /etc/sysconfig/keymap $MNTTMP/etc/sysconfig/keymap + +##################################################################### +#create initrd +##################################################################### +cd $HOMESOURCE +./create_initramfs.sh +cp ${DIRTEMP}work/initramfs.igz $MNTTMP/boot/ + +##################################################################### +#grub install +##################################################################### +chroot $MNTTMP grub-install --no-floppy --recheck ${USBDEVICE:0:8} +umount $MNTTMP/proc +umount $MNTTMP/sys +umount $MNTTMP/dev + +##################################################################### +#copy fstab for usbkey +##################################################################### +cp -f fstab.usbkey $MNTTMP/etc/fstab.new + +##################################################################### +#change password root +##################################################################### +chroot $MNTTMP passwd + +##################################################################### +#this file is detected by initramfs for determine / +##################################################################### +date > $MNTTMP/FrugalMove + +good_msg "Usb key Frugalware is created !" +good_msg "For add a new user :" +good_msg "boot with your key," +good_msg "useradd fooname -m -G users,wheel,audio,tty -s /bin/bash" _______________________________________________ Frugalware-git mailing list Frugalware-git@frugalware.org http://frugalware.org/mailman/listinfo/frugalware-git