Gentoo Archives: gentoo-user

From: thelma@×××××××××××.com
To: gentoo-user@l.g.o, Bas Zoutendijk <slzoutendijk@×××××.com>
Subject: Re: [gentoo-user] bash scrip prompt after bootstrap
Date: Fri, 30 Mar 2018 18:20:07
Message-Id: 4014463a-7553-4216-3562-6b4695ac4b3d@sys-concept.com
In Reply to: Re: [gentoo-user] bash scrip prompt after bootstrap by Bas Zoutendijk
1 On 03/30/2018 11:10 AM, Bas Zoutendijk wrote:
2 > On Fri 30 Mar 2018 at 10:33:45 -0600, thelma@×××××××××××.com wrote:
3 >> I'm using a scrip to log-in/boot strap the system over NFS
4 >>
5 >> -----
6 >> #!/bin/sh
7 >>
8 >> HOST=${0##*/}
9 >> HOST=${HOST#*-}
10 >> ROOT=/mnt/${HOST}
11 >> ...
12 >> exec chroot '${ROOT}' /bin/bash -l
13 >> ---
14 >>
15 >> When I'm presented with bash prompt, it is the same as the one I logged
16 >> IN from. So to eliminate the confusion I would like to change (add to)
17 >> the bash prompt the "HOST' name I log-in to.
18 >>
19 >> When I log-in I'm presented with: "syscon3 #"
20 >> I would like it to be: ROOT+HOST
21 >> eg.: syscon3-eden
22 >
23 > To change the prompt you want to set $PS1. For example:
24 >
25 > echo 'export PS1="some string"; exec </dev/tty' | exec chroot $ROOT /bin/bash -i
26 >
27 > This command tells the Bash inside the chroot to first execute
28 >
29 > export PS1="some string"
30 >
31 > and then to continue as a regular log-in shell. The special syntax of
32 > the $PS1 string in described in the Bash man page. If you just want to
33 > prepend a string, you do not even have to bother with crafting a syntax:
34 >
35 > echo 'export PS1="(chroot '$HOST') $PS1"; exec <dev/tty' | exec chroot $ROOT /bin/bash -i
36 >
37 > Sincerely,
38 >
39 > Bas
40
41 Thank you for the input. I'll try it as soon as my box finished
42 compiling (-e @world), and post the complete script; to boot strap over
43 NFS (it might help others).
44
45 This method of compiling give some of my old (obsolete) system new lease
46 of life.
47 I've dusted off my retired (it hasn't been updated in over 250-days):
48 VIA Eden Processor 1200MHz 1GB of RAM
49 (was running asterisk, hylafax)
50
51 and updating it over NFS.
52 gcc-6.4.0-r1 took only 1:39hr to compile over NFS on:
53 AMD Ryzen 5 1400 Quad-Core Processor 16GB or RAM
54
55 When I was switching to a new profile on my another system (in production)
56 Intel(R) Atom(TM) CPU 330 @ 1.60GHz 2GB or RAM
57
58 and gcc-6.4.0-r1 with MAKEOPTS="-j5" would not compile; I had to
59 downgraded recompile gcc with MAKEOPTS="-j1"
60 gcc-6.4.0-r1 with MAKEOPTS="-j5" was running for over 6hr and
61 failed;with MAKEOPTS="-j1" it took over 12hr to compile just
62 gcc-6.4.0-r1 :-/
63
64 What a wast of time! considering that on that network I have AMD 8-core
65 with 32GB of RAM idling.
66 If I implemented that bootstrap over NFS it would recompile my entire
67 @world in 1 days (or 12hr) instead of several several days.
68
69 Happy Easter to everybody!
70 --
71 Thelma