From ca24a885d23b8f307a3505ef2a0fd2eaefbb9436 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Tue, 5 Jan 2016 17:43:02 +0000 Subject: [PATCH] Avoid reprocessing bashrc --- src/freedombone | 11 +++++++---- src/freedombone-image-customise | 6 ++---- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/freedombone b/src/freedombone index 6422efd8..35f70cf9 100755 --- a/src/freedombone +++ b/src/freedombone @@ -2104,13 +2104,14 @@ function mesh_cjdns_tools { if [ ! -f ~/.bashrc ]; then touch ~/.bashrc fi + export GOPATH=$HOME/projects/go if ! grep -q "export GOPATH=" ~/.bashrc; then echo 'export GOPATH=$HOME/projects/go' >> ~/.bashrc fi if ! grep -q "export PATH=$PATH:$HOME/projects/go/bin" ~/.bashrc; then + export PATH=$PATH:$HOME/projects/go/bin echo 'export PATH=$PATH:$HOME/projects/go/bin' >> ~/.bashrc fi - . ~/.bashrc export GOPATH=$HOME/projects/go export PATH=$PATH:$HOME/projects/go/bin go get github.com/inhies/cjdcmd @@ -6401,6 +6402,7 @@ function install_gogs { fi export GOPATH=/home/git/go + systemctl set-environment GOPATH=/home/git/go # update to the next commit if [ -d /var/www/$GIT_DOMAIN_NAME ]; then @@ -6446,7 +6448,6 @@ function install_gogs { echo 'export GOPATH=/home/git/go' >> ~/.bashrc echo 'systemctl set-environment GOPATH=/home/git/go' >> ~/.bashrc fi - . ~/.bashrc if [ ! -d $GOPATH ]; then mkdir -p $GOPATH fi @@ -9382,6 +9383,9 @@ function install_ipfs { return fi + export GOPATH=/home/git/go + systemctl set-environment GOPATH=/home/git/go + # update to the next commit if [ -d /home/git/go/src/github.com/ipfs/go-ipfs ]; then if grep -q "ipfs commit" $COMPLETION_FILE; then @@ -9417,7 +9421,6 @@ function install_ipfs { echo 'export GOPATH=/home/git/go' >> ~/.bashrc echo 'systemctl set-environment GOPATH=/home/git/go' >> ~/.bashrc fi - . ~/.bashrc export GOPATH=/home/git/go if [ ! -d $GOPATH ]; then mkdir -p $GOPATH @@ -9426,9 +9429,9 @@ function install_ipfs { IPFS_PATH=/home/git/go/bin if ! grep -q 'GOPATH/bin' ~/.bashrc; then + export PATH="$GOPATH/bin:$PATH:" echo 'export PATH="$GOPATH/bin:$PATH:";' >> ~/.bashrc fi - . ~/.bashrc # set gopath for the user if ! grep -q "GOPATH=" /home/$MY_USERNAME/.bashrc; then diff --git a/src/freedombone-image-customise b/src/freedombone-image-customise index 3aeea542..e1ee2e60 100755 --- a/src/freedombone-image-customise +++ b/src/freedombone-image-customise @@ -242,10 +242,8 @@ if [ -f ~/.initial_setup ]; then fi EOF - cat >> $rootdir/root/.bashrc <> $rootdir/root/.bashrc + echo 'if [ -f ~/.initial_setup ]; then' >> $rootdir/root/.bashrc echo ' if [ -f ~/login.txt ]; then' >> $rootdir/root/.bashrc echo ' NEW_USER_PASSWORD=$(printf `cat ~/login.txt`)' >> $rootdir/root/.bashrc echo ' else' >> $rootdir/root/.bashrc