Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- if [ "$(uname -m)" == "x86_64" ]
- then PHARO_URL=get.pharo.org/64/
- else PHARO_URL=get.pharo.org
- fi
- CACHE_FILE=clean-env.tgz
- while [[ $# -gt 0 ]]
- do
- case "$1" in
- --fresh)
- echo "Cleaning Cache"
- rm -f "$CACHE_FILE"
- ;;
- --clean)
- DOWNLOAD=NO
- ;;
- *)
- # unknown option
- ;;
- esac
- shift # past argument or value
- done
- # Clean Environment
- echo "Cleaning Environment"
- find . -maxdepth 1 -not \( -name "." -o -name "$CACHE_FILE" -o -name "$(basename "$0")" -o -name "startup.st" -o -name "user-properties" \) -exec rm -rf {} \;
- if [ "$DOWNLOAD" != "NO" ]
- then
- if [ -f "$CACHE_FILE" ]
- then
- echo "Restoring from Cache"
- tar zxf "$CACHE_FILE"
- else
- echo "Downloading Pharo from $PHARO_URL"
- if which curl > /dev/null
- then curl "${PHARO_URL}" | bash
- else wget -O - -q "${PHARO_URL}" | bash
- fi
- echo "Saving downloaded files to Cache"
- tar zcf "$CACHE_FILE" --exclude="$CACHE_FILE" --exclude="$(basename "$0")" --exclude="startup.st" --exclude="user-properties" ./*
- fi
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement