瀏覽代碼

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

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

@@ -242,10 +242,8 @@ if [ -f ~/.initial_setup ]; then
242 242
 fi
243 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 247
     echo '    if [ -f ~/login.txt ]; then' >> $rootdir/root/.bashrc
250 248
     echo '        NEW_USER_PASSWORD=$(printf `cat ~/login.txt`)' >> $rootdir/root/.bashrc
251 249
     echo '    else' >> $rootdir/root/.bashrc