Help - Zoeken - Gebruikers - Kalender
Volledige versie: Direct install to usb-pendrive
MandrivaClub.NL > MCNLive > MCNLive: International
rockingbilly
After reading the subject posted three days ago about adding start-up scripts to an iso before burning, I became interested. Until then I thought that an install to usb had to be preceded by burning a cd. This is not the case.
I have successfully created an install using one script, which produces a ready-to-start usb-pendrive.
The script I use is like this:
mklivecd --verbose --tmp=/home/guest/tmp --nofile ^/home/guest/live.iso --nodir=^/mnt,^/tmp,^/root/tmp /home/guest/live.iso
mount -o loop /home/guest/live.iso /home/guest/tmp/remaster/
cp /home/guest/tmp/remaster/livecd.sqfs /mnt/removable/.

A few remarks:
1.For this script to succeed it is necessary that the usb-pendrive must be inserted (obviously), it is mounted on /mnt/removable.
2.Also for the created install to be reasonably small my data-drives must be excluded (the --nodir option).
3.In this script it is presumed the pendrive has already been made installable using the script provided by the mcnlive-menu.
4.Of course it is possible to change the isolinux.cfg to have bootcodes that match your system.

There are still two issues on my system to be solved:
1. I have a Hercules smart tv-card. Although it is installed properly on my Mandriva-install, the usb-pendrive startup refuses to recognise it. A workaround is the running of the following script (as root of course):
rmmod bttv
modprobe bttv card=100 tuner=5

2. I have not succeeded yet in getting more than the usual 1024x768 resolution. I still have to select another resolution in mcc, and then to restart the x-server.

It would be nice if a post-install-script could be executed (like Knoppix does) which could contain the lines described above (rmmod etc)
Then the resolution-option could be solved by copying an xorg.conf from another drive, and even drives could be mounted in the proper way (right now I'm using hda5 as datadrive containing my virtual machines, but on another pc this drive is hdc5..)

But anyway, I am very satisfied with the way my usb-install can be created and modified, I think the mcnlive is a great distribution!
kris
We have already some threads about replacing the files on the usb stick without re-burning the CD :-)

It is even possible to setup the usb stick (without CD) - but it is not comfortable for a newbie.
--nodir=^/mnt,^/tmp,^/root/tmp

Have a look in /usr/sbin/mklivecd -

my $nodirs         = '^/[.].* ^/dev$ ^/initrd$ ^/lost+found$ ^/mnt$ ^/media$ ^/proc$ ^/sys$ ^/tmp$ ^/var/tmp$';


biggrin.gif Two are already excluded by default. And in /toot/tmp nothing is written - unless you work as root.

TV card: when your tv card is not configured automatically at start up, the best way is to file a bug report at mandriva. Usually it is a question of minutes for the drakxtool maintainer to add it. Same goes for the resolution /video config.

But if you prefer not to make a bug report and write scripts - all your needed commands can directly go to:

/etc/rc.d/rc.local

You can even introduce 'cheatcodes' here if you want:

cmdline=$(cat /proc/cmdline)
if strstr "$cmdline" rockingbilly; then
rmmod bttv
modprobe bttv card=100 tuner=5
fi
rockingbilly
(kris @ Apr 1 2007, 10:19 PM) [snapback]82133[/snapback]

Two are already excluded by default. And in /toot/tmp nothing is written - unless you work as root.

So the growing of my iso was only due to not excluding my previous iso. The --nofile option seems the only one necessary

TV card: when your tv card is not configured automatically at start up, the best way is to file a bug report at mandriva. Usually it is a question of minutes for the drakxtool maintainer to add it.

I must admit I have never made a bug report before. Can be a thing to do tomorrow.

But if you prefer not to make a bug report and write scripts - all your needed commands can directly go to:

/etc/rc.d/rc.local

You can even introduce 'cheatcodes' here if you want:

cmdline=$(cat /proc/cmdline)
if strstr "$cmdline" rockingbilly; then
rmmod bttv
modprobe bttv card=100 tuner=5
fi


Looks very cheaty but also very promising. Actually I'm trying it right now (but I do not know yet if it works, creating an iso takes 20 minutes in total). With such an option I can localize my distribution: based on bootcodes I can mount different drives on different pc's to the same mountpoint.
rockingbilly
(kris @ Apr 1 2007, 10:19 PM) [snapback]82133[/snapback]

all your needed commands can directly go to:

/etc/rc.d/rc.local

You can even introduce 'cheatcodes' here if you want:

cmdline=$(cat /proc/cmdline)
if strstr "$cmdline" rockingbilly; then
rmmod bttv
modprobe bttv card=100 tuner=5
fi


I cannot get this to work. It works if I enter the commands in plain in rc.local, but if I surround them by if-statements, like you indicated (cheatcodes), the code is not executed, no matter how hard I try. Add them to the "append=" line in syslinux.cfg, or even type them in using livecd nousb params: Nothing helps. Makes me long for a startup-script as there is in Knoppix. Knoppix looks for a default file somewhere on the disks, and asks whether to execute it yes or no.
kris
Would be great if you could provide the knoppix scripts and implement them in our code.
I don't know nothing about knoppix and don't have the time to look at it.
kris
Rocking, try this rc.local:

#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.

touch /var/lock/subsys/local

# returns OK if $1 contains $2
strstr() {
  [ "${1#*$2*}" = "$1" ] && return 1
  return 0
}

cmdline=$(cat /proc/cmdline)
if strstr "$cmdline" rockingbilly; then
rmmod bttv
modprobe bttv card=100 tuner=5
fi


The function 'strstr' was not declared. You can test rc.local without building a new iso.

* Start the cd, with the new bootcode, but without this changed rc.local.
* Make sure, the modules are not loaded (su, lsmod).
* Copy the new rc.local over the old. In a terminal run rc.local. Check if the modules are loaded.

If it still does not work, have a look in:
/etc/rc.d/init.d/functions
and in:
/etc/rc.d/init.d/rc.sysinit
Dit is een "Print" versie van onze forums. Om de volledige versie met meer informatie, afbeeldingen en opmaakte bekijken, a.u.b. klik hier.