LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 09-05-2010, 09:09 PM   #1
Kenny_Strawn
Senior Member
 
Registered: Feb 2010
Location: /usa/ca/orange_county/lake_forest
Distribution: ArchBang, Google Android 2.1 + Motoblur (on Motortola Flipside), Google Chrome OS (on Cr-48)
Posts: 1,791
Blog Entries: 62

Rep: Reputation: 54
Chroot in shell scripts: Ensuring that subsequent commands execute within the chroot


I currently am writing a shell script to install and configure a full system without Ubiquity and have run into a roadblock: When the script gets to the chroot (that being "sudo chroot <install drive mount point>, inside the chroot nothing happens. It just leaves me with the main prompt. Any ideas on how to fix this?
 
Old 09-06-2010, 02:09 PM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 26,984
Blog Entries: 54

Rep: Reputation: 2742Reputation: 2742Reputation: 2742Reputation: 2742Reputation: 2742Reputation: 2742Reputation: 2742Reputation: 2742Reputation: 2742Reputation: 2742Reputation: 2742
The manual page says 'chroot NEWROOT [COMMAND...]' as in 'sudo chroot echo "Hello World!";'? meaning you can either run a command directly or drop a shell script in the chroot and execute that.
 
Old 05-21-2012, 12:25 PM   #3
Siljrath
Member
 
Registered: Nov 2004
Location: the internet
Distribution: sid, slack, gentoo, witch, bedrock, etc
Posts: 148

Rep: Reputation: 26
sry for being slow with this.


just to clarify,
so where one might normally add /bin/bash, one can replace it with a script?

like in my case the line:
Code:
chroot /mnt/$DISTRONAME /bin/bash
becomes
Code:
chroot /mnt/$DISTRONAME witchroot
witchroot being the script i had just generated.

does that seem right?

or would the ~ no, i'll simply ask that^ before i get any more confused.


...also... i wonder if there's a way (~sorry, perhaps veering somewhat off-topic with this~) to pass variables to the chrooted environment too. is there?
 
  


Reply

Tags
chroot, maverick meerkat, shell script


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
chroot: cannot execute /bin/sh: Exec format error jnojr Linux - General 8 06-24-2012 12:52 AM
[SOLVED] in chroot compiled programs do not work in chroot graphit Linux From Scratch 2 04-11-2010 03:04 AM
start init.d scripts before a chroot script using schroot? arobinson74 Linux - Software 1 10-11-2009 04:05 PM
chroot to run hd-installed distro's programs from chroot in live distro? silencestone Linux - Software 0 10-12-2007 06:29 AM
wu-ftp help with chroot - ls command does not execute bock Linux - Software 2 09-18-2002 01:47 PM


All times are GMT -5. The time now is 11:11 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration