浏览代码

Avoid reprocessing bashrc

Bob Mottram 9 年前
父节点
当前提交
ca24a885d2
共有 2 个文件被更改,包括 9 次插入8 次删除
  1. 7
    4
      src/freedombone
  2. 2
    4
      src/freedombone-image-customise

+ 7
- 4
src/freedombone 查看文件

2104
     if [ ! -f ~/.bashrc ]; then
2104
     if [ ! -f ~/.bashrc ]; then
2105
         touch ~/.bashrc
2105
         touch ~/.bashrc
2106
     fi
2106
     fi
2107
+    export GOPATH=$HOME/projects/go
2107
     if ! grep -q "export GOPATH=" ~/.bashrc; then
2108
     if ! grep -q "export GOPATH=" ~/.bashrc; then
2108
         echo 'export GOPATH=$HOME/projects/go' >> ~/.bashrc
2109
         echo 'export GOPATH=$HOME/projects/go' >> ~/.bashrc
2109
     fi
2110
     fi
2110
     if ! grep -q "export PATH=$PATH:$HOME/projects/go/bin" ~/.bashrc; then
2111
     if ! grep -q "export PATH=$PATH:$HOME/projects/go/bin" ~/.bashrc; then
2112
+        export PATH=$PATH:$HOME/projects/go/bin
2111
         echo 'export PATH=$PATH:$HOME/projects/go/bin' >> ~/.bashrc
2113
         echo 'export PATH=$PATH:$HOME/projects/go/bin' >> ~/.bashrc
2112
     fi
2114
     fi
2113
-    . ~/.bashrc
2114
     export GOPATH=$HOME/projects/go
2115
     export GOPATH=$HOME/projects/go
2115
     export PATH=$PATH:$HOME/projects/go/bin
2116
     export PATH=$PATH:$HOME/projects/go/bin
2116
     go get github.com/inhies/cjdcmd
2117
     go get github.com/inhies/cjdcmd
6401
     fi
6402
     fi
6402
 
6403
 
6403
     export GOPATH=/home/git/go
6404
     export GOPATH=/home/git/go
6405
+    systemctl set-environment GOPATH=/home/git/go
6404
 
6406
 
6405
     # update to the next commit
6407
     # update to the next commit
6406
     if [ -d /var/www/$GIT_DOMAIN_NAME ]; then
6408
     if [ -d /var/www/$GIT_DOMAIN_NAME ]; then
6446
         echo 'export GOPATH=/home/git/go' >> ~/.bashrc
6448
         echo 'export GOPATH=/home/git/go' >> ~/.bashrc
6447
         echo 'systemctl set-environment GOPATH=/home/git/go' >> ~/.bashrc
6449
         echo 'systemctl set-environment GOPATH=/home/git/go' >> ~/.bashrc
6448
     fi
6450
     fi
6449
-    . ~/.bashrc
6450
     if [ ! -d $GOPATH ]; then
6451
     if [ ! -d $GOPATH ]; then
6451
         mkdir -p $GOPATH
6452
         mkdir -p $GOPATH
6452
     fi
6453
     fi
9382
         return
9383
         return
9383
     fi
9384
     fi
9384
 
9385
 
9386
+    export GOPATH=/home/git/go
9387
+    systemctl set-environment GOPATH=/home/git/go
9388
+
9385
     # update to the next commit
9389
     # update to the next commit
9386
     if [ -d /home/git/go/src/github.com/ipfs/go-ipfs ]; then
9390
     if [ -d /home/git/go/src/github.com/ipfs/go-ipfs ]; then
9387
         if grep -q "ipfs commit" $COMPLETION_FILE; then
9391
         if grep -q "ipfs commit" $COMPLETION_FILE; then
9417
             echo 'export GOPATH=/home/git/go' >> ~/.bashrc
9421
             echo 'export GOPATH=/home/git/go' >> ~/.bashrc
9418
             echo 'systemctl set-environment GOPATH=/home/git/go' >> ~/.bashrc
9422
             echo 'systemctl set-environment GOPATH=/home/git/go' >> ~/.bashrc
9419
         fi
9423
         fi
9420
-        . ~/.bashrc
9421
         export GOPATH=/home/git/go
9424
         export GOPATH=/home/git/go
9422
         if [ ! -d $GOPATH ]; then
9425
         if [ ! -d $GOPATH ]; then
9423
             mkdir -p $GOPATH
9426
             mkdir -p $GOPATH
9426
 
9429
 
9427
     IPFS_PATH=/home/git/go/bin
9430
     IPFS_PATH=/home/git/go/bin
9428
     if ! grep -q 'GOPATH/bin' ~/.bashrc; then
9431
     if ! grep -q 'GOPATH/bin' ~/.bashrc; then
9432
+        export PATH="$GOPATH/bin:$PATH:"
9429
         echo 'export PATH="$GOPATH/bin:$PATH:";' >> ~/.bashrc
9433
         echo 'export PATH="$GOPATH/bin:$PATH:";' >> ~/.bashrc
9430
     fi
9434
     fi
9431
-    . ~/.bashrc
9432
 
9435
 
9433
     # set gopath for the user
9436
     # set gopath for the user
9434
     if ! grep -q "GOPATH=" /home/$MY_USERNAME/.bashrc; then
9437
     if ! grep -q "GOPATH=" /home/$MY_USERNAME/.bashrc; then

+ 2
- 4
src/freedombone-image-customise 查看文件

242
 fi
242
 fi
243
 EOF
243
 EOF
244
 
244
 
245
-    cat >> $rootdir/root/.bashrc <<EOF
246
-# initial setup of the system
247
-if [ -f ~/.initial_setup ]; then
248
-EOF
245
+    echo '# initial setup of the system' >> $rootdir/root/.bashrc
246
+    echo 'if [ -f ~/.initial_setup ]; then' >> $rootdir/root/.bashrc
249
     echo '    if [ -f ~/login.txt ]; then' >> $rootdir/root/.bashrc
247
     echo '    if [ -f ~/login.txt ]; then' >> $rootdir/root/.bashrc
250
     echo '        NEW_USER_PASSWORD=$(printf `cat ~/login.txt`)' >> $rootdir/root/.bashrc
248
     echo '        NEW_USER_PASSWORD=$(printf `cat ~/login.txt`)' >> $rootdir/root/.bashrc
251
     echo '    else' >> $rootdir/root/.bashrc
249
     echo '    else' >> $rootdir/root/.bashrc