Skip to content

Commit a1cab52

Browse files
committed
Initial commit of git update scripts
1 parent ca1f36b commit a1cab52

File tree

7 files changed

+164
-0
lines changed

7 files changed

+164
-0
lines changed

git_update_scripts/checkout-pr.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/usr/bin/env bash
2+
3+
git --git-dir=/factorio/scenarios/PR/.git/ --work-tree=/factorio/scenarios/PR/ fetch origin
4+
git --git-dir=/factorio/scenarios/PR/.git/ --work-tree=/factorio/scenarios/PR/ reset --hard origin/pr/"$1"
5+
6+
echo '_DEBUG = true' > /factorio/scenarios/PR/map_selection.lua
7+
echo '_CHEATS = true' >> /factorio/scenarios/PR/map_selection.lua
8+
echo "return require 'map_gen.maps.default'" >> /factorio/scenarios/PR/map_selection.lua
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/usr/bin/env bash
2+
3+
git --git-dir=/factorio/scenarios/crashsite/.git/ --work-tree=/factorio/scenarios/crashsite/ fetch origin
4+
git --git-dir=/factorio/scenarios/crashsite/.git/ --work-tree=/factorio/scenarios/crashsite/ reset --hard origin/develop
5+
6+
echo "return require 'map_gen.maps.crash_site'" > /factorio/scenarios/crashsite/map_selection.lua
7+
rm /factorio/scenarios/crashsite/map_gen/data -rf
8+
rm /factorio/scenarios/crashsite/redmew_git_banner.png
9+
touch /factorio/scenarios/crashsite
10+
echo "Crashsite updated successfully"
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/usr/bin/env bash
2+
3+
name=dev-testing
4+
5+
git --git-dir=/factorio/scenarios/$name/.git/ --work-tree=/factorio/scenarios/$name/ fetch origin
6+
git --git-dir=/factorio/scenarios/$name/.git/ --work-tree=/factorio/scenarios/$name/ reset --hard origin/develop
7+
8+
rm /factorio/scenarios/$name/map_gen/data/.map_previews -rf
9+
rm /factorio/scenarios/$name/redmew_git_banner.png
10+
11+
touch /factorio/scenarios/$name
12+
echo '_DEBUG = true' > /factorio/scenarios/$name/map_selection.lua
13+
echo '_CHEATS = true' >> /factorio/scenarios/$name/map_selection.lua
14+
echo "return require 'map_gen.maps.default'" >> /factorio/scenarios/$name/map_selection.lua
15+
echo "$name updated successfully"

git_update_scripts/update-develop.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/usr/bin/env bash
2+
3+
git --git-dir=/factorio/scenarios/develop/.git/ --work-tree=/factorio/scenarios/develop/ fetch origin
4+
git --git-dir=/factorio/scenarios/develop/.git/ --work-tree=/factorio/scenarios/develop/ reset --hard origin/develop
5+
6+
cp /factorio/scenarios/develop/map_selection.lua.sample /factorio/scenarios/develop/map_selection.lua
7+
touch /factorio/scenarios/develop
8+
echo "Develop updated successfully"
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#!/usr/bin/env bash
2+
#$1 = $folder = the folder folder
3+
#$2 = the repository
4+
#$3 = the branch
5+
#$4 = the map to load
6+
#$5 = debug + cheat
7+
8+
set -e
9+
10+
if [ -z "$1" ] || [ -z "$2" ] || [ -z "$3" ] || [ -z "$4" ]
11+
then
12+
echo "Missing argument"
13+
exit 1
14+
fi
15+
16+
### Below is generic
17+
18+
folder=$1
19+
repository=$2
20+
branch=$3
21+
map=$4
22+
debug=$5
23+
24+
git --git-dir=/factorio/scenarios/"$folder"/.git/ --work-tree=/factorio/scenarios/"$folder"/ fetch "$repository"
25+
git --git-dir=/factorio/scenarios/"$folder"/.git/ --work-tree=/factorio/scenarios/"$folder"/ reset --hard "$repository/$branch"
26+
27+
rm /factorio/scenarios/"$folder"/map_gen/data/.map_previews -rf
28+
rm /factorio/scenarios/"$folder"/redmew_git_banner.png
29+
30+
if [ -z "$debug" ]
31+
then
32+
echo "Setting up without debug"
33+
echo "return require 'map_gen.maps.$map'" >> /factorio/scenarios/"$folder"/map_selection.lua
34+
else
35+
echo "Setting up with debug"
36+
echo '_DEBUG = true' > /factorio/scenarios/"$folder"/map_selection.lua
37+
echo '_CHEATS = true' >> /factorio/scenarios/"$folder"/map_selection.lua
38+
echo "return require 'map_gen.maps.$map'" >> /factorio/scenarios/"$folder"/map_selection.lua
39+
fi
40+
41+
touch /factorio/scenarios/"$folder"

git_update_scripts/update-grilled.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/usr/bin/env bash
2+
#$1 = the branch
3+
4+
folder=grilled
5+
6+
if [ -z "$1" ]
7+
then
8+
echo "Missing argument"
9+
exit 1
10+
fi
11+
12+
git --git-dir=/factorio/scenarios/$folder/.git/ --work-tree=/factorio/scenarios/$folder/ fetch $folder
13+
git --git-dir=/factorio/scenarios/$folder/.git/ --work-tree=/factorio/scenarios/$folder/ reset --hard $folder/"$1"
14+
15+
rm /factorio/scenarios/$folder/map_gen/data/.map_previews -rf
16+
rm /factorio/scenarios/$folder/redmew_git_banner.png
17+
18+
touch /factorio/scenarios/$folder
19+
echo '_DEBUG = true' > /factorio/scenarios/$folder/map_selection.lua
20+
echo '_CHEATS = true' >> /factorio/scenarios/$folder/map_selection.lua
21+
echo "return require 'map_gen.maps.default'" >> /factorio/scenarios/$folder/map_selection.lua

git_update_scripts/update-plague.sh

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
#!/usr/bin/env bash
2+
#$1 = the branch
3+
4+
if [ -z "$1" ]
5+
then
6+
echo "Missing argument"
7+
exit 1
8+
fi
9+
10+
folder=plague
11+
repository=plague
12+
branch=$1
13+
14+
if [ -z "$2" ]
15+
then
16+
map_check=$2
17+
else
18+
map_check=default
19+
fi
20+
21+
### These need to be set by something
22+
23+
folder=plague
24+
repository=plague
25+
branch=$1
26+
map=map_check
27+
cleanup=$5
28+
debug=$6
29+
30+
### Below is generic
31+
32+
if [ -z "$folder" ] || [ -z "$repository" ] || [ -z "$branch" ] || [ -z "$map" ]
33+
then
34+
echo "Missing argument"
35+
exit 1
36+
fi
37+
38+
git --git-dir=/factorio/scenarios/"$folder"/.git/ --work-tree=/factorio/scenarios/"$folder"/ fetch "$repository"
39+
git --git-dir=/factorio/scenarios/"$folder"/.git/ --work-tree=/factorio/scenarios/"$folder"/ reset --hard "$repository/$branch"
40+
41+
if [ -z "$cleanup" ]
42+
then
43+
echo "Deleting "
44+
rm /factorio/scenarios/"$folder"/map_gen/data/.map_previews -rf
45+
fi
46+
47+
rm /factorio/scenarios/"$folder"/map_gen/data/.map_previews -rf
48+
rm /factorio/scenarios/"$folder"/redmew_git_banner.png
49+
50+
if [ -z "$debug" ]
51+
then
52+
echo "Setting up without debug"
53+
echo "return require 'map_gen.maps.$map'" >> /factorio/scenarios/"$folder"/map_selection.lua
54+
else
55+
echo "Setting up with debug"
56+
echo '_DEBUG = true' > /factorio/scenarios/"$folder"/map_selection.lua
57+
echo '_CHEATS = true' >> /factorio/scenarios/"$folder"/map_selection.lua
58+
echo "return require 'map_gen.maps.$map'" >> /factorio/scenarios/"$folder"/map_selection.lua
59+
fi
60+
61+
touch /factorio/scenarios/"$folder"

0 commit comments

Comments
 (0)