Skip to content

Commit f212406

Browse files
authored
Merge pull request #54 from eMoflon/feature/update-script
Adds Eclipse install/update script
2 parents 4479954 + b725932 commit f212406

File tree

2 files changed

+76
-0
lines changed

2 files changed

+76
-0
lines changed

README.md

+12
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,23 @@ Currently, the list of additional packages includes:
3030

3131
Feel free to request others, e.g., via Github issues.
3232

33+
3334
## Usage/Installation
3435

36+
Quick installation using curl and bash:
37+
`$ FOLDER="$HOME/eclipse-apps/emt"; mkdir -p $FOLDER && cd $FOLDER && curl https://raw.githubusercontent.com/eMoflon/emoflon-eclipse-build/main/emoflon-update.sh | bash -s -- $FOLDER`
38+
39+
### Normal installation
40+
3541
**The latest release can be found [here](https://github.com/eMoflon/emoflon-eclipse-build/releases/latest).**
3642
Download an archive for the version you are looking for from the release page and extract it.
3743

44+
### Updating
45+
46+
You can use the [update script](./eclipse-update.sh) to update your installation.
47+
Example usage:
48+
`$ ./eclipse-update.sh ~/eclipse-apps/emt`
49+
3850

3951
## Runner requirements
4052

emoflon-update.sh

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
#!/bin/bash
2+
3+
#
4+
# Config
5+
#
6+
7+
ECLIPSE_ARCHIVE=eclipse-emoflon-windows-dev # Name of the archive to download
8+
FORCE_DOWNLOAD=0 # 1 = force download of new archive
9+
TARGET_DIR=$1 # Target directory
10+
API_URL="https://api.github.com/repos/eMoflon/emoflon-eclipse-build/releases/latest"
11+
12+
set -e
13+
START_PWD=$PWD
14+
15+
#
16+
# Utils
17+
#
18+
19+
# Displays the given input including "=> " on the console.
20+
log () {
21+
printf "=> $1\n"
22+
}
23+
24+
#
25+
# Script
26+
#
27+
28+
if [[ -z "$TARGET_DIR" ]]; then
29+
log "Parameter for target directory was empty. Exit.\n Call script with the parameter, e.g.:\n ./eclipse-update.sh /home/mkratz/eclipse-apps/emt"
30+
exit 1;
31+
fi
32+
33+
log "Started Eclipse install/update script."
34+
cd $TARGET_DIR
35+
36+
# Get eclipse
37+
if [[ ! -f "./$ECLIPSE_ARCHIVE.zip" ]] || [[ "$FORCE_DOWNLOAD" = "1" ]]; then
38+
TAG=$(curl -s $API_URL \
39+
| grep "\"name\"\: \"v" \
40+
| cut -d : -f 2,3 \
41+
| tr -d \" |tr -d ,)
42+
log "Downloading latest eMoflon Eclipse archive from Github.\nRelease:$TAG"
43+
curl -s $API_URL \
44+
| grep "$ECLIPSE_ARCHIVE.*zip" \
45+
| cut -d : -f 2,3 \
46+
| tr -d \" \
47+
| wget -qi -
48+
fi
49+
50+
if [[ -f "./eclipse" ]]; then
51+
log "Rename old Eclipse folder."
52+
mv ./eclipse ./eclipse-old
53+
fi
54+
55+
log "Extract new Eclipse archive."
56+
unzip -qq -o $ECLIPSE_ARCHIVE.zip
57+
58+
if [[ -f "./eclipse-old" ]]; then
59+
log "Remove old Eclipse folder."
60+
rm -rf ./eclipse-old
61+
fi
62+
63+
cd $START_PWD
64+
log "Updated successfully."

0 commit comments

Comments
 (0)