This is the old SliTaz forum - Please use the main forum.slitaz.org

tazdev code to have chroot prompt and xterm title - feature proposal
  • erniaernia October 2010
    because i've found myself working in a tazdev chroot without remembering to be in a chroot i've added these row in the case that evaluates $1 , when $1 is chroot, before the row "echo -e "\nChrooting in $ROOTFS...\n"":
    		if ! grep -q "chroot" $ROOTFS/etc/profile; then
    echo 'PS1="\[\033]0;chroot: \w\007\]chroot \w\\# "' >> $ROOTFS/etc/profile
    fi
    export PS1="$PS1\[\033]2;$TERM\007"
    .
    This will change your prompt to makes you remember that you are in a chroot and your xterm title to help you to find or avoit the iconified xterm window.
    this row
    		export PS1="$PS1\[\033]2;$TERM\007"
    after the chroot command row (chroot $ROOTFS /bin/sh --login) will bring back things to the original state when you exit from the chroot.
    just for sharing

    a little question about tazdev: would not it make more sense to have a stable rootfs.gz expanded when you have "stable" as $2 ?

  • erniaernia October 2010
    i was wrong with the code, the only way i got it working is
    		if ! grep -q "chroot" $ROOTFS/etc/profile; then
    echo 'PS1="\[\033]0;chroot: \w\007\]chroot \w\\# "' >> $ROOTFS/etc/profile
    fi
    before the chroot row and
    PS1="$PS1\[\033]2;$TERM\007"
    in the end of /etc/profile, i can't find a way to change $PS1 in the terminal from where i run tazdev
  • erniaernia October 2010
    ok, i give up, xterm title does not work yet, it's time to turn off pc for some days...
    where the hell $PS1 came from? if i source /etc/profile i got the thing working but after boot $PS1 is the default slitaz one, even if i've moved the PS1="$PS1\[\033]2;$TERM\007" row before the export of env variables in /etc/profile.
    it does not come from /etc/bashrc either, i've modified that too...
  • erniaernia October 2010
    i need some rest i think. PS1="$PS1\[\033]2;$TERM\007" must go in your ~/.profile instead of /etc/profile

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In Apply for Membership

SliTaz Social