[solved] Trying to make a bash function work for (chroot)

So this is what I have so far.
function arch-chroot () {
sudo & mount /dev/sda1 /mnt
cd /mnt
mount -t proc proc proc/
mount --rbind /sys sys/
mount --rbind /dev dev/
mount --rbind /run run/
chroot /mnt /bin/bash
I get stuck at cd /mnt. This is how I do it in terminal. I can't quite figure out to move past 'cd'.
# just use the arch-install-scripts. Simple and easy. ------------
Last edited by jedijimi (2015-01-25 18:11:19)

It could be something like this:
if [[ $EUID != 0 ]]; then
echo "This script should be ran as root" && exit 1
fi
mount -t proc /proc $1/proc
mount --rbind /sys $1/sys
mount --rbin /dev $1/dev
mount --rbind /run $1/run
chroot $1
This way it uses the default shell and asks for a new root as a parameter. But instead of reinventing the wheel just install arch-install-scripts as it only weights ~0.05MiB. Also when trilby had asked what do you want to do, he meant why are you using "sudo & ..." as sudo can't be run in background.
Next time you can't find which package provides certain executable file, just use pkgfile.

Similar Messages

  • How do you make the 'places' function work in iphoto

    `i have just imported a lot of old photos from my 2007 macbook onto a new macbook pro with ilife 09. `i am trying to make the places function work but can't get it to work. The 'i' icon does not appear in the bottom right hand corner of the events main photo as it's supposed too. Any suggestions?

    Simply open an event; select 1 or more photos and select the i in the lower right corner of a photo thumbnail. You will get the Geocoding window. Start typing the address/place/country in the location area. For detailed addresses you select new place. You can resize the window. Maps from google appears and you select the place it finds. You can even drag the pin to a specific area. Press ok and your done.

  • HT3819 For home sharing do you have to use one apple ID? Im trying to make my own new account for all my devices (iphone, ipad, mac) , but i still want the music from my dads account.

    For home sharing do you have to use one apple ID? Im trying to make my own new account for all my devices (iphone, ipad, mac) , but i still want the music from my dads account.

    For home sharing do you have to use one apple ID? Im trying to make my own new account for all my devices (iphone, ipad, mac) , but i still want the music from my dads account.

  • Im trying to make a simple 360 rotation for a 3d logo in CC 2014 but when i tried to create the 1st key frame the image when out axis

    im trying to make a simple 360 rotation for a 3d logo in CC 2014 but when i tried to create the 1st key frame the image when out axis

    I find that if you have multiple 3d object  they must be merged into a single 3d layer their positions reset to align to the same axises then sized and positioned along them. The layer should then be able to be animated well around an axis like the y axis. Here a Sphere, Cylinder and ring. http://www.mouseprints.net/old/dpr/McAssey-CC.mp4

  • Trying to make a back ground transparent for a web site

    Trying to make a back ground transparent for a web site on a logo image

    There is no picture? Did you try sending it by email? You'll have to sign into the forum and use the camera icon to upload. Thank you.
    Benjamin

  • [svn] 3256: More changes to get remote browser functionality working for MXUnit.

    Revision: 3256
    Author: [email protected]
    Date: 2008-09-18 09:14:24 -0700 (Thu, 18 Sep 2008)
    Log Message:
    More changes to get remote browser functionality working for MXUnit.
    Need to copy http client jars from trunk/lib to trunk/qa/lib as part of the build. The http client jars are used by MXUnit when the remote browser, browser factory is being used.
    Also need to copy xalan.jar from trunk/lib to trunk/qa/lib now as William recently made changes to MXUnit that added a dependency on xalan.jar.
    In mxunit/build.xml made the browserFactory class for the MXUnit task use a property called mxunitBrowserFactory so different browser factories can now be passed in.
    Modified Paths:
    blazeds/trunk/qa/apps/qa-regress/build.xml
    blazeds/trunk/qa/apps/qa-regress/testsuites/mxunit/build.xml
    blazeds/trunk/qa/build.properties
    blazeds/trunk/qa/resources/frameworks/qa-frameworks.zip

    Ah, interesting. Here's what I get when I boot with the old GeForce 7300 plugged in.
    System Profiler shows no extensions with "ATI" in the name. I'm not sure if this is to be expected though. Does System Profiler -> Software -> Extensions display the kexts installed on the system, or only those that the kernel decided to load at boot time? If the latter, I guess I wouldn't expect to see them. If the former, then might there be some registration step I need to do to tell the system that the ATI kexts are present and able to be loaded?
    As for the presence of the extensions, if I look in /System/Library/Extensions, I find the following files when I do an 'ls -lF | grep ATI'...
    ATI1300Controller.kext
    ATI1600Controller.kext
    ATI1900Controller.kext
    ATI2400Controller.kext
    ATI2600Controller.kext
    ATI3800Controller.kext
    ATI4500Controller.kext
    ATI4600Controller.kext
    ATI4800Controller.kext
    ATI5000Controller.kext
    ATIFramebuffer.kext
    ATIRadeonX1000.kext
    ATIRadeonX1000GA.plugin
    ATIRadeonX1000GLDriver.bundle
    ATIRadeonX1000VADriver.bundle
    ATIRadeonX2000.kext
    ATIRadeonX2000GA.plugin
    ATIRadeonX2000GLDriver.bundle
    ATIRadeonX2000VADriver.bundle
    ATIRadeonX3000.kext
    ATIRadeonX3000GA.plugin
    ATIRadeonX3000GLDriver.bundle
    ATIRadeonX3000VADriver.bundle
    ATISupport.kext
    So lots of ATI-related goodies. The dates are all either Aug 2 or Aug 6, so I'm guessing they came with the Snow Leopard Graphics Update, which I think was released just after those dates.
    I'm getting ready to return the card and try another, but will hold off another day or two, since it still seems plausible that there might be a software issue lurking...
    Thanks again for your help,
    Jerry

  • How to make an onKeyPressed function work

    Hi, i have some problems with making the onkeyPressed function work. Somehow when i run it, it complains about "'static' is no longer supported. It will be removed from the language soon. Use script-level declarations for Right ". So i need to get around it. Here's the code. Make an image or replace an image with spacecraft.png.
    var frame = 0;
    var spaceship: ImageView;
    var Spaceship = Image { url: "{__DIR__}spacecraft.png" }
    var KeyX: Number = 100;
    var KeyY: Number = 100;
    var offsetX: Integer;          // Possible values are -1, 0 and 1
    var offsetY: Integer;
    var x;
    var MoveLeft;
    var MoveUp;
    var MoveDown;
    var transition: Transition;
    Stage {
    visible: true
    title: "Spaceship"
    scene: Scene {
    width: 250
    height: 200
    content: [
    ImageView {
    image: Spaceship
    onKeyPressed: function(e: KeyEvent): Void {
    if (e.code == KeyCode.VK_RIGHT) {
    Move.Right
    if (e.code == KeyCode.VK_LEFT) {
    var y: Number = 200;
    var X: Number = 200;
    // Timeline updates y variable
    static class Move extends CustomNode {
    var image: Image;
    var transition: Transition;
    var fitWidth: Number;
    static var Right = Move {
    image: Spaceship
    translateX: 300
    translateY: 100
    fitWidth: 150
    transition: TranslateTransition {
    duration: 2s
    byX: 250 repeatCount: Timeline.INDEFINITE
    autoReverse: true
    }

    I tried the node.requestFocus(), but apparently, their is a new error when I ran it . It said "java.lang.StackOverflowError" with many at errors following it .Here our my fx codes. If you run it on your IDE, it should say the same error.
    Main.Fx
    Stage {
        visible: true
        title: "Spaceship"
        scene: Scene {
            width: 250
            height: 200
            content: [Move {}]
    }Move.fx
    var y: Number = 200;
    var X: Number = 200;
    var Spaceship = Image { url: "{__DIR__}spacecraft 2 png.png" }
    // Timeline updates y variable
    public class Move extends CustomNode {
        var image: Image;
        var transition1: Transition;
        var fitWidth: Number;
        var Right = Move {
                    image: Spaceship
                    translateX: 300
                    translateY: 100
                    fitWidth: 150
                    transition1: TranslateTransition {
                        duration: 2s
                        byX: 250 repeatCount: Timeline.INDEFINITE
                        autoReverse: true
    public override function create(): Node {
            //Assign Group to variable
            var myGroup = Group {
                        content: [Move.Right
                        focusTraversable: true
                        onKeyPressed: function(e: KeyEvent): Void {
                            if (e.code == KeyCode.VK_RIGHT) {
                                Move.Right;
                                transition1.play()
                        onKeyReleased: function(e: KeyEvent): Void {
                           if (e.code == KeyCode.VK_RIGHT) {
                                Move.Right;
                                transition1.pause()
                    } //Group
            myGroup.requestFocus(); //This sets the focus on the group that is to be returned and put onto the stage
            return myGroup
    }

  • [solved] sudo command in a Bash function?

    Hello there,
    I need to use sudo inside of a Bash function in order to allow my laptop to hibernate after a certain time using "systemctl hibernate".
    However, I cannot figure out what's the correct way to include sudo inside of my function snippet:
    function hibernate {
    echo "System is going to hibernate in $1 minute(s)..."
    sleep $1m ; systemctl hibernate
    alias hibernate_timer=sudo hibernate # sudo misplaced here
    Last edited by orschiro (2013-06-26 20:33:47)

    you'd need sudo's -E parameter for that, otherwise that function is not defined in the su environment.
    EDIT: -E is not sufficient.
    man sudoers wrote:In all cases, environment variables with a value beginning with () are
         removed as they could be interpreted as bash functions.  The list of environ‐
         ment variables that sudo allows or denies is contained in the output of “sudo
         -V” when run as root.
    You cannot pass functions to sudo - the alias is not relevant, you couldn't do this directly: `sudo hibernate` would fail.
    I'd also recommend putting the sudo as "deep" as possible: right on the systemctl command.  There is a reason bash functions are not allowed to be 'sudo'ed - and running sudo on a function that includes a sleep command seem particularly bad to me.
    Last edited by Trilby (2013-06-26 17:59:18)

  • What change to the firewall Java is trying to make when it is launched for the first time?

    We are upgrading our jpi from 7u60 to 7u67.  We are running EBS 12.1.  We are having issues trying to deploy this to the organization with zero prompts and messages.  We are getting a firewall prompt from the plugin the first time we launch EBS.  What change to the firewall is java trying to make when we launch the plugin from EBS the first time?  I have attached screen shots of the messages we are seeing.  The first screen shot is on Windows 7x86 and the second is on Windows 7x64.  The x86 is prompting for jp2launcher.exe
    while the x64 is prompting to allow java.exe.  This is the same software package for both instances and we are using the IE 32-bit browser.

    You haven't downgraded the iOS or lost any features, what you've done is restored your phone from an old iOS backup.

  • [SOLVED] Trying to make command into bash alias

    Here is a command I would like to make into an easy to use bash alias:
    #Copy results of a find to somewhere
    find -iname "*something*" -exec cp '{}' /path/to/copy/results/to \;
    I realize there are usually several ways to do something in the shell, so if a better way of course I'm all for any tips but if I wanted to make this an alias so that I just had to do:
    alias pattern pathtocopyto
    How would I? I have tried:
    alias findcp="find -iname "$1" -exec cp '{}' $2/ \;"
    But this does not work, says it cannot find the search term when I ran it in a test dir full of properly named files and dirs.
    TIA for any help
    Last edited by colbert (2008-12-17 23:19:09)

    Hmm, I tried that Procyon, I could see the HD light on the case go solid so it was running the find but it did not work. I have a file called "layla.mp3" and a dir called "test" in the current dir, ran it like this:
    findcp layla test
    Gave no result and test was still empty Thanks for the help guys hopefully can get this to go..

  • Adobe rep tried to make Premiere CC (2014) work on my PC and now my screen remains black!!

    Hi all,
         I am trying to solve this issue that Adobe Representative Sarthak Girdhar has caused. Approximately three days ago, I used Adobe's online chat service to help get my trials of Premiere CC 2014 and After Effects 2014 working on my Windows 7 Ultimate operating system. I had a friend build the computer for me and it's fully specced out to handle 4K, 64-bit software, etc.
         BEFORE I reached out to Mr. Girdhar, I updated my Windows 7 Ultimate operating system. It was only when that didn't work that I reached out to him!
         To make a long story short, Mr. Girdhar had me connect via TeamViewer so that he could run some tests and what not. Since I am a sole-proprietor, I continued doing work on my laptop while I waited for him. Towards the end of the online session, he said he was going to do something to the drivers for my GPUs (I run dual ASUS GeForce GTX 780Ti 3GB GDDR5 GPU (x2) in SLI Configuration) and, the next thing I know, the screen is black. I know the computer is on and running because I can see the fans spinning and a number of lights on on the motherboard. As per the attached image, Mr. Girdhar claims that I need to contact Microsoft "and along with it install the updates for your OS because I saw that your OS didn’t even have Service Pack 1 installed."
    What do I do now?!?!@

    Try:                                               
    - iOS: Not responding or does not turn on           
    - Also try DFU mode after try recovery mode
    How to put iPod touch / iPhone into DFU mode « Karthik's scribblings
    - If not successful and you can't fully turn the iOS device fully off, let the battery fully drain. After charging for an least an hour try the above again.
    - Try another cable              
    - Try on another computer                                                       
    - If still not successful that usually indicates a hardware problem and an appointment at the Genius Bar of an Apple store is in order.
    Apple Retail Store - Genius Bar                                     

  • I am trying to make an Edge Animation work on a CMS. I used "AdobeEdge.loadComposition" to find the .JS file, but it is looking for the images in the "/image" folder. I would like to store the images in another place. Please help me accomplish this.

    Here's the code:
    <script type="text/javascript" charset="utf-8" src="http://animate.adobe.com/runtime/5.0.1/edge.5.0.1.min.js"></script>
    <style>
        .edgeLoad-EDGE-4084323 { visibility:hidden; }
    </style
    <script>
       AdobeEdge.loadComposition('/media/products/edge_script/channels', 'EDGE-4084323', {
        scaleToFit: "none",
        centerStage: "none",
        minW: "0",
        maxW: "undefined",
        width: "361px",
        height: "268px"
    }, {"dom":{}}, {"dom":{}});
    </script>
    <div align="center">
      <div id="Stage" class="EDGE-4084323">
      </div>
    </div>
    Thank you for your help.

    Ahhhhhh, ok. Figured this one out after digging more.
    Here's the answer from another post. Hope it helps someone!
    If you need to set an absolute folder url, or you are pulling the content from a server that does not host the content, you can manually update the <projectname>_edge.js file to specify the directory:
    (function($, Edge, compId){
    //images folder
    var im='<SERVER/FOLDER>/images/';
    Just beware that if you re-publish the files, you'll need to redo any custom modifications.  I do this for off-server projects and it works very well so long as you make all the changes in each JS file where you need to specify the exact path.

  • How do you make the mouseover function work?

    My Firefox mouseover function does not work. It stopped working two updates ago. It used to work just fine. I recently updated to version 3.6.13 on my Mac (version 10.5.8), and still no success. I've tried quitting Firefox and restarting, deleting Firefox and re-downloading, shutting down and re-starting the computer. Still no Luck. Any help would be most appreciated.

    Issues with tooltips not working properly have been reported to be caused by the Google Toolbar (Tools > Add-ons > Extensions)<br />
    You can check if there is an update available that fixes that issue.<br />
    You can try to uninstall and reinstall the latest Google Toolbar.<br />
    * https://www.google.com/intl/en/toolbar/ff/

  • Trying to make a php file work with my email form

    Hello,
    Going slightly mad trying to link my php file with my html and actually getting it to work.
    It (the php file) keeps coming up with a syntax error on line 37 - code hinting may not work etc etc but there is no error from what I can see - can anyone else point out the obviously to me? This is driving me around the bend!
    my code:
    <?php
    /*Subject and Email Variables */
        $emailSubject = 'Website Form';
        $webMaster = '[email protected]';
    /* Gathering Data Variables */
        $nameField = $_POST['name'];
        $addressField = $_POST['address'];
        $telephone1Field = $_POST['telephone1'];
        $telephone2Field = $_POST['telephone2'];
        $emailField = $_POST['email'];
        $name2Field = $_POST['name2'];
        $ageField = $_POST['age'];
        $dobField = $_POST['dob'];
        $commsField = $_POST['comms'];
        $messageField = $_POST['message'];
        $body = <<<EOD
    <br><hr><br>
    Name: $name <br>
    Address: $address <br>
    Telephone (daytime): $telephone1 <br>
    Telephone (mobile): $telephone2 <br>
    Email: $email <br>
    Childs Name: $name2 <br>
    Start Age: $age <br>
    Childs Date of Birth: $dob <br>
    Preferred form of communication: $comms <br>
    Message: $message <br>
    EOD;
        $headers = "From: $email\r\n";
        $headers .= "Content-type: text/html\r\n";
        $success = mail{$webMaster, $emailSubject,$body, $headers};
    /* Results rendered as HTML */
        $theResults = <<<EOD
    <html>
    <head>
    <title>Xxx</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <style type="text/css">
    <!--
    body {
        background-color: #f1f1f1;
        font-family: Verdana, Arial, Helvetica, sans-serif;
        font-size: 12px;
        font-style: normal;
        line-height: normal;
        font-weight: normal;
        color: #666666;
        text-decoration: none;
    -->
    </style>
    </head>
    <div>
      <div align="left">Thank you for your message, Your email will be answered very soon!</div>
    </div>
    </body>
    </html>
    EOD;
    echo "$theResults";
    ?>

    Line 37 is this:
        $success = mail{$webMaster, $emailSubject,$body, $headers};
    It should be this:
        $success = mail($webMaster, $emailSubject, $body, $headers);
    Also the header for the From: is this:$headers = "From: $email\r\n"; but I don't see the variable defined for $email
    Also you should know about email injection. Someone could inject your headers and add additional BCC: addresses to send emails to many undisclosed recipients through your mail script. You'd be using your script to turn your server into a host for spam! Sanitize your fields to prevent injection attacks! Security should be the firt priority followed by functionality. If it's unsecure it shouldn't function

  • Help Please. Running Out of Ideas Trying to Make iTunes 7.6 Work

    Ok, I have literally spent hours trying to solve this problem and so far nothing is working.
    iTunes 7.6 (and 7.5) will install perfectly on my computer. However, when I go to run the program, nothing happens. If I look in the task manager, it shows that the iTunes process is running and using about 15megs of RAM. Despite this, nothing happens. No interface, no errors, nothing.
    Here is what I have tried:
    1)I have tried running the program with multiple users and the same thing happens, process is running, nothing happens.
    2)I went in and tinkered with the msconfig file to ensure no programs were conflicting with iTunes.
    3)I deleted and removed pretty much every Apple file from my system.
    4)I have tried doing a clean install of iTunes and Quicktime and it doesn't fix anything.
    Quicktime is working. The version of Quicktime running is 7.4, I think that is the newest version of Quicktime.
    At this point, I am pretty much flustered and stuck. I don't know what else to do, short of reformatting Windows and trying it then. I don't particularly want to do this though, especially when the problem started when iTunes 7.5 came out. iTunes 7.4 works though it also give me an error but at least it works.
    If anyone can help me, I would greatly appreciate it. Thanks.

    If iTunes.exe persists in the task manager even though iTunes doesn't launch, it means something is causing iTunes to hang during start up.
    Restart you PC prior to troubleshooting to ensure nothing is hanging when you start troubleshooting, or use the task manager to terminate iTunes.exe.
    You should run a virus and spyware scan as malware can do this although this is not particularly likey.
    Some firewalls have done this in the past, so try a start up with your firewall off, again not very likely thee days.
    After that a good first step is to establish whether iTunes will start in another account. This narrows down the possibilities a lot.
    The following ariticle on freezes tells you how and also how to proceed with troubleshooting once you know if the problem is account specific or system wide.
    http://docs.info.apple.com/article.html?artnum=302856
    I am going to take a guess that you will end up having to use MSConfig to look for conflicts.

Maybe you are looking for