Commit df5df188 authored by Joshua Tauberer's avatar Joshua Tauberer

fixes for bootstrap.sh for upgrading

* `git fetch` wasn't done right for shallow clones
* the test for whether mailinabox has already been cloned wasn't looking at the right directory if the script was not run from $HOME
parent 0b5bf602
...@@ -17,12 +17,12 @@ if [[ $EUID -ne 0 ]]; then ...@@ -17,12 +17,12 @@ if [[ $EUID -ne 0 ]]; then
fi fi
# Clone the Mail-in-a-Box repository if it doesn't exist. # Clone the Mail-in-a-Box repository if it doesn't exist.
if [ ! -d mailinabox ]; then if [ ! -d $HOME/mailinabox ]; then
echo Installing git . . . echo Installing git . . .
DEBIAN_FRONTEND=noninteractive apt-get -q -q install -y git < /dev/null DEBIAN_FRONTEND=noninteractive apt-get -q -q install -y git < /dev/null
echo echo
echo Downloading Mail-in-a-Box . . . echo Downloading Mail-in-a-Box $TAG. . .
git clone \ git clone \
-b $TAG --depth 1 \ -b $TAG --depth 1 \
https://github.com/mail-in-a-box/mailinabox \ https://github.com/mail-in-a-box/mailinabox \
...@@ -38,7 +38,7 @@ cd $HOME/mailinabox ...@@ -38,7 +38,7 @@ cd $HOME/mailinabox
# Update it. # Update it.
if [ "$TAG" != `git describe` ]; then if [ "$TAG" != `git describe` ]; then
echo Updating Mail-in-a-Box to $TAG . . . echo Updating Mail-in-a-Box to $TAG . . .
git fetch git fetch --depth 1 --force --prune origin tag $TAG
if ! git checkout -q $TAG; then if ! git checkout -q $TAG; then
echo "Update failed. Did you modify something in `pwd`?" echo "Update failed. Did you modify something in `pwd`?"
exit exit
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment