forked from libretro/libretro-super
-
Notifications
You must be signed in to change notification settings - Fork 0
/
libretro-upgrade.sh
executable file
·116 lines (107 loc) · 3.07 KB
/
libretro-upgrade.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
#! /usr/bin/env bash
# vim: set ts=3 sw=3 noet ft=sh : bash
SCRIPT="${0#./}"
BASE_DIR="${SCRIPT%/*}"
WORKDIR="$PWD"
if [ "$BASE_DIR" = "$SCRIPT" ]; then
BASE_DIR="$WORKDIR"
else
if [[ "$0" != /* ]]; then
# Make the path absolute
BASE_DIR="$WORKDIR/$BASE_DIR"
fi
fi
found_nothing=1
libretro_move_libretro_common() {
if [ -f "$WORKDIR/libretro-sdk/file/config_file.c" ]; then
found_nothing=""
echo ""
echo "=== Detected old libretro-sdk (now libretro-common)"
if [ -d "$WORKDIR/libretro-common" ]; then
echo " libretro-common already exists"
echo ""
echo -n " Would you like to delete libretro-sdk? [y/N] : "
read user
if [[ "$user" = "y" || "$user" == "Y" ]]; then
echo " Deleting libretro-sdk..."
rm -rf "$WORKDIR/libretro-sdk"
else
echo "Retaining libretro-sdk at your request."
fi
else
echo ""
echo " will move it"
mv "$WORKDIR/libretro-sdk" "$WORKDIR/libretro-common"
fi
fi
}
libretro_bsnes_one_copy() {
if [ -d "$WORKDIR/libretro-bsnes/perf" ]; then
found_nothing=""
echo ""
echo "=== Detected bsnes duplicates"
echo " libretro-super no longer needs three copies of bsnes"
echo ""
echo -n " Would you like to delete the extras? [y/N] : "
read user
if [[ "$user" = "y" || "$user" == "Y" ]]; then
echo " Deleting libretro-bsnes/balanced..."
rm -rf "$WORKDIR/libretro-bsnes/balanced"
echo " Deleting libretro-bsnes/perf..."
rm -rf "$WORKDIR/libretro-bsnes/perf"
else
echo " Retaining bsnes duplicates at your request."
fi
fi
}
libretro_devkit_mgit_dir_0="libretro-manifest"
libretro_devkit_mgit_dir_1="libretrodb"
libretro_devkit_mgit_dir_2="libretro-dat-pull"
libretro_devkit_mgit_dir_3="libretro-common"
libretro_move_devkit() {
if [ -d "$WORKDIR/libretrodb" ]; then
found_nothing=""
if [ -d "$WORKDIR/libretro-devkit" ]; then
echo ""
echo "=== Detected multiple copies of libretro devkit"
echo " devkit has moved to a subdir, but you have old copies installed."
echo ""
echo -n " Would you like to delete the extras? [y/N] : "
read user
if [[ "$user" = "y" || "$user" == "Y" ]]; then
echo " Removing old versions of devkit..."
rm -rf "$WORKDIR/libretro-manifest"
rm -rf "$WORKDIR/libretrodb"
rm -rf "$WORKDIR/libretro-dat-pull"
rm -rf "$WORKDIR/libretro-common"
else
echo " Retaining devkit duplicates at your request."
fi
else
echo ""
echo "=== Detected devkit installed in working directory"
echo " Found in \"$WORKDIR\""
echo " Should be \"$WORKDIR/libretro-devkit\""
echo ""
echo " will move it"
mkdir -p "$WORKDIR/libretro-devkit"
mv "$WORKDIR/libretro-manifest" "$WORKDIR/libretro-devkit"
mv "$WORKDIR/libretrodb" "$WORKDIR/libretro-devkit"
mv "$WORKDIR/libretro-dat-pull" "$WORKDIR/libretro-devkit"
mv "$WORKDIR/libretro-common" "$WORKDIR/libretro-devkit"
fi
fi
}
if [ -n "$1" ]; then
while [ -n "$1" ]; do
"$1"
shift
done
else
libretro_move_libretro_common
libretro_bsnes_one_copy
libretro_move_devkit
fi
if [ -n "$found_nothing" ]; then
echo "Nothing to upgrade."
fi