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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
#!/bin/sh
# License GPL
########################################################################
clear && echo '
████─████─████─███─█───█─███─█──█─███
█──█─█──█─█──█──█──█───█──█──██─█─█
████─█──█─████──█──█─█─█──█──█─██─███
█────█──█─█─█───█──█████──█──█──█─█
█────████─█─█───█───█─█──███─█──█─███
'
########################################################################
export gamedir="DIRNAME"
export gamename="NAME"
export portname="PortNAME"
export port_ver="XX"
########################################################################
export PROGS_INST=""
export vexit=0
for PROGS in "wget" "curl" "zenity" "tar" "xterm"
do
if [ ! -x "`which "${PROGS}" 2>/dev/null`" ];then
PROGS_INST="${PROGS_INST} ${PROGS}"
vexit=1
fi
done
if [ "${vexit}" -eq "1" ];then
echo "You will need to install: ${PROGS_INST}, and restart the script"
exit 1
fi
########################################################################
cd "$(dirname "`readlink -f "$0"`")"
links="$(pwd)"
setup_script="${portname}"-"${port_ver}"
ARCH_NAME="${setup_script}.tar.xz"
deflink="/home/${USER}/PortWINE/${portname}"
[ $(id -u) -eq 0 ] && echo "Do not run the script from the superuser!" && zenity --error --text "Do not run the script from the superuser!" 2> /dev/null && exit 1
########################################################################
SET_LANG=`zenity --title "Install $portname" --text "Select the installation language \nВыберите язык установки" --list --radiolist \
--column="Set (Выбор)" --column "Language (Язык):" \
TRUE "Русский" \
FALSE "English" ` 2> /dev/null
if [ $? -eq 1 ];then exit 1; fi
case $SET_LANG in
"Русский")
INFO_TEXT="Вы запустили установщик PortWINE ${gamename} версии ${port_ver}. \n\nЭто не коммерческий продукт и развивается исключительно за идею и Ваши пожертвования. \nВсе права сторонего програмного обеспечения принадлежат их владельцам! \nПродолжая установку вы автоматически соглашаетесь с данными условиями." ;;
"English")
INFO_TEXT="You run the installer PortWINE ${gamename} v. ${port_ver}. \n\nThis is not a commercial product and developed exclusively for the idea and donate. \nAll rights to third-party software belong to their respective owners! \nContinuing the installation of you agree to these terms." ;;
esac
`zenity --info --title "INFO" --text "$INFO_TEXT" --no-wrap ` 2> /dev/null
if [ $? -eq 1 ];then echo "error" && exit 1; fi
########################################################################
case $SET_LANG in
"Русский")
inst1=`zenity --title "Install ${portname}" --text "Выберите путь для установки (обновления) порта,\nили оставьте его по умолчанию." --list --radiolist --width=350 --height=220 \
--column="Выбор" --column "Путь:" \
TRUE "${deflink}" \
FALSE "Другой путь..." ` 2> /dev/null
if [ $? -eq 1 ];then exit 1; fi
case $inst1 in
"${deflink}")
D_PATH="${deflink}" ;;
"Другой путь...")
D_PATH=`zenity --file-selection --directory --title="Выберите путь..." `
D_PATH="${D_PATH}/${portname}" ;;
esac ;;
"English")
inst1=`zenity --title "Install ${portname}" --text "Select the installation path (update) port,\nor leave it in default." --list --radiolist --width=350 --height=220 \
--column="Set..." --column "Path:" \
TRUE "${deflink}" \
FALSE "Other path..." ` 2> /dev/null
if [ $? -eq 1 ];then exit 1; fi
case $inst1 in
"${deflink}")
D_PATH="${deflink}" ;;
"Other path...")
D_PATH=`zenity --file-selection --directory --title="Select the path..." `
D_PATH="${D_PATH}/${portname}" ;;
esac ;;
esac
if [ $? -eq 1 ];then echo "error" && exit 1; fi
########################################################################
case $SET_LANG in
"Русский")
zen() {
zenity --progress --title="Установка..." --text="Настройка ${portname}" --pulsate --auto-close --auto-kill --width=450 > /dev/null 2>&1
} ;;
"English")
zen() {
zenity --progress --title="Install..." --text="Install ${portname}" --pulsate --auto-close --auto-kill --width=450 > /dev/null 2>&1
} ;;
esac
if [ $? -eq 1 ];then echo "error" && exit 1; fi
########################################################################
export PORT_WINE_PATH="${D_PATH}"
if [ ! -d "${PORT_WINE_PATH}" ];then
mkdir -p "$PORT_WINE_PATH"
else
for CLEAN_PORT in "dist" "libs" "tmp" "img" "scripts" "pfx/drive_c/windows"
do
if [ -d "${PORT_WINE_PATH}/data/${CLEAN_PORT}" ];then
rm -fR "${PORT_WINE_PATH}/data/${CLEAN_PORT}"
fi
done
if [ -d "${PORT_WINE_PATH}/data/pfx/drive_c/Games/${gamedir}" ];then
export PORT_GAMEDIR="${PORT_WINE_PATH}/data/pfx/drive_c/Games/${gamedir}"
mv -f "${PORT_GAMEDIR}" "${PORT_GAMEDIR}_old"
elif [ -d "${PORT_WINE_PATH}/data/pfx/drive_c/Program Files/${gamedir}" ];then
export PORT_GAMEDIR="${PORT_WINE_PATH}/data/pfx/drive_c/Program Files/${gamedir}"
mv -f "${PORT_GAMEDIR}" "${PORT_GAMEDIR}_old"
elif [ -d "${PORT_WINE_PATH}/data/pfx/drive_c/Program Files (x86)/${gamedir}" ];then
export PORT_GAMEDIR="${PORT_WINE_PATH}/data/pfx/drive_c/Program Files (x86)/${gamedir}"
mv -f "${PORT_GAMEDIR}" "${PORT_GAMEDIR}_old"
fi
fi
########################################################################
mkdir -p "${PORT_WINE_PATH}/data/tmp"
echo "${port_ver}" > "${PORT_WINE_PATH}/data/tmp/${portname}_ver"
case $SET_LANG in
"Русский")
echo "RUS" > "${PORT_WINE_PATH}/data/tmp/${portname}_loc" ;;
"English")
echo "ENG" > "${PORT_WINE_PATH}/data/tmp/${portname}_loc" ;;
esac
if [ $? -eq 1 ];then echo "error" && exit 1; fi
export config_path="${PORT_WINE_PATH}/data/tmp"
read "update_loc" < "${config_path}/${portname}_loc"
export update_loc=${update_loc}
########################################################################
cd "${PORT_WINE_PATH}"
tail -n +166 "${links}/${setup_script}" > "${PORT_WINE_PATH}/${ARCH_NAME}"
tar -Jxvf "${PORT_WINE_PATH}/${ARCH_NAME}" -C "${PORT_WINE_PATH}/" | zen
mv -f "${PORT_WINE_PATH}/${ARCH_NAME}" "${PORT_WINE_PATH}/data/tmp"
sed -n 1,165p "${links}/${setup_script}" > "${PORT_WINE_PATH}/data/tmp/${setup_script}"
########################################################################
if [ -d "${PORT_GAMEDIR}_old" ];then
rm -fR "${PORT_GAMEDIR}"
mv -f "${PORT_GAMEDIR}_old" "${PORT_GAMEDIR}"
fi
if [ -d "${PORT_GAMEDIR}" ];then
if [ -d "${PORT_GAMEDIR}_rus" ];then
rm -fR "${PORT_GAMEDIR}_rus"
fi
if [ -d "${PORT_GAMEDIR}_eng" ];then
rm -fR "${PORT_GAMEDIR}_eng"
fi
elif [ "${update_loc}" = "RUS" ];then
if [ -d "${PORT_GAMEDIR}_rus" ];then
mv -f "${PORT_GAMEDIR}_rus" "${PORT_GAMEDIR}"
if [ -d "${PORT_GAMEDIR}_eng" ];then
rm -fR "${PORT_GAMEDIR}_eng"
fi
fi
else
if [ -d "${PORT_GAMEDIR}_eng" ];then
mv -f "${PORT_GAMEDIR}_eng" "${PORT_GAMEDIR}"
if [ -d "${PORT_GAMEDIR}_rus" ];then
rm -fR "${PORT_GAMEDIR}_rus"
fi
fi
fi
########################################################################
cd "${PORT_WINE_PATH}/data/scripts"
sh "${PORT_WINE_PATH}/data/scripts/setup" && exit 0
################################ARCH_BIN################################