Commit 9ba832b5 authored by Mikhail Tergoev's avatar Mikhail Tergoev

Added gitlab.eterfund.ru for download scripts

parent 73f265a2
#!/usr/bin/env bash #!/usr/bin/env bash
# Author: Castro-Fidel (PortWINE-Linux.ru) # Author: Mikhail Tergoev (linux-gaming.ru)
# License MIT # License MIT
######################################################################## ########################################################################
unset PW_AUTOPLAY PW_SET_LANG PW_SILENT_INSTALL unset PW_AUTOPLAY PW_SET_LANG PW_SILENT_INSTALL
...@@ -7,14 +7,18 @@ export portname="PortProton" ...@@ -7,14 +7,18 @@ export portname="PortProton"
export port_ver=1.0 export port_ver=1.0
######################################################################## ########################################################################
deflink="${HOME}/PortWINE/${portname}" deflink="${HOME}/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 if [ "$(id -u)" == "0" ] ; then
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
fi
if [ "$(dirname "`readlink -f "$0"`")" == "/usr/bin" ] ; then if [ "$(dirname "`readlink -f "$0"`")" == "/usr/bin" ] ; then
[ -z "${XDG_DATA_HOME}" ] && export XDG_DATA_HOME="$HOME/.local/share" [ -z "${XDG_DATA_HOME}" ] && export XDG_DATA_HOME="$HOME/.local/share"
if [ -f "${XDG_DATA_HOME}/PortWINE/PortProton/data/scripts/start.sh" ] ; then if [ -f "${XDG_DATA_HOME}/PortWINE/PortProton/data/scripts/start.sh" ] ; then
/usr/bin/env bash "${XDG_DATA_HOME}/PortWINE/PortProton/data/scripts/start.sh" "$@" /usr/bin/env bash "${XDG_DATA_HOME}/PortWINE/PortProton/data/scripts/start.sh" "$@"
exit 0 exit 0
else else
if [ ! -z "`locale | grep "LANG=ru_RU.UTF-8"`" ] ; then if [ ! -z "$(locale | grep "LANG=ru_RU.UTF-8")" ] ; then
PW_SET_LANG="Russian" PW_SET_LANG="Russian"
else else
PW_SET_LANG="English" PW_SET_LANG="English"
...@@ -34,18 +38,18 @@ for PROGS in "wget" "curl" "tar" "awk" "zenity" "cabextract" "pidof" ; do ...@@ -34,18 +38,18 @@ for PROGS in "wget" "curl" "tar" "awk" "zenity" "cabextract" "pidof" ; do
PROGS_INST="${PROGS_INST} ${PROGS}" && vexit=1 PROGS_INST="${PROGS_INST} ${PROGS}" && vexit=1
fi fi
done done
if [ "${vexit}" -eq "1" ] ; then if [ "${vexit}" == "1" ] ; then
echo "You will need to install: ${PROGS_INST}, and restart the script" echo "You will need to install: ${PROGS_INST}, and restart the script"
exit 1 exit 1
fi fi
######################################################################## ########################################################################
cd "$(dirname "`readlink -f "$0"`")" cd "$(dirname "$(readlink -f "$0")")"
links="$(pwd)" links="$(pwd)"
######################################################################## ########################################################################
if [ "$1" = "-rus" ] ; then if [ "$1" == "-rus" ] ; then
PW_SET_LANG="Russian" PW_SET_LANG="Russian"
export PW_SILENT_INSTALL="1" export PW_SILENT_INSTALL="1"
elif [ "$1" = "-eng" ] ; then elif [ "$1" == "-eng" ] ; then
PW_SET_LANG="English" PW_SET_LANG="English"
export PW_SILENT_INSTALL="1" export PW_SILENT_INSTALL="1"
elif [ -z "${PW_SET_LANG}" ] ; then elif [ -z "${PW_SET_LANG}" ] ; then
...@@ -64,7 +68,7 @@ elif [ -z "${PW_SET_LANG}" ] ; then ...@@ -64,7 +68,7 @@ elif [ -z "${PW_SET_LANG}" ] ; then
if [ $? -eq 1 ] ; then echo "error" && exit 1 ; fi if [ $? -eq 1 ] ; then echo "error" && exit 1 ; fi
fi fi
######################################################################## ########################################################################
if [ "${PW_SILENT_INSTALL}" = "1" ] ; then if [ "${PW_SILENT_INSTALL}" == "1" ] ; then
echo "${portname} is installed in ${deflink}" echo "${portname} is installed in ${deflink}"
D_PATH="${deflink}" D_PATH="${deflink}"
else else
...@@ -128,33 +132,38 @@ esac ...@@ -128,33 +132,38 @@ esac
export PORT_WINE_TMP_PATH="${PORT_WINE_PATH}/data/tmp" export PORT_WINE_TMP_PATH="${PORT_WINE_PATH}/data/tmp"
cd "${PORT_WINE_PATH}" cd "${PORT_WINE_PATH}"
try_download_scripts () { try_download_scripts () {
wget -O "${PORT_WINE_TMP_PATH}/PortWINE-master.tar.gz" -nd -c --read-timeout 300 \ echo "Try download scripts from gitlab.eterfund.ru..."
--retry-connrefused --timeout 15 --tries 3 \ if ! wget -O "${PORT_WINE_TMP_PATH}/PortWINE-master.tar.gz" -nd -c --read-timeout 300 \
--user-agent="Mozilla/5.0 (compatible; Konqueror/2.1.1; X11)" \ --retry-connrefused --timeout 15 --tries 3 \
"https://github.com/Castro-Fidel/PortWINE/archive/refs/heads/master.tar.gz" --user-agent="Mozilla/5.0 (compatible; Konqueror/2.1.1; X11)" \
"https://gitlab.eterfund.ru/Castro-Fidel/PortWINE/-/archive/master/PortWINE-master.tar.gz"
then
echo -e "Error.\nTry download scripts from github.com..."
wget -O "${PORT_WINE_TMP_PATH}/PortWINE-master.tar.gz" -nd -c --read-timeout 300 \
--retry-connrefused --timeout 15 --tries 3 \
--user-agent="Mozilla/5.0 (compatible; Konqueror/2.1.1; X11)" \
"https://github.com/Castro-Fidel/PortWINE/archive/refs/heads/master.tar.gz"
[ "$?" != "0" ] && echo "Fatal error! Exiting." && exit 1
fi
echo "Try unpacking scripts..."
tar -xvzf "${PORT_WINE_TMP_PATH}/PortWINE-master.tar.gz" -C "${PORT_WINE_TMP_PATH}"
if [ "$?" = "0" ] ; then if [ "$?" = "0" ] ; then
tar -xvzf "${PORT_WINE_TMP_PATH}/PortWINE-master.tar.gz" -C "${PORT_WINE_TMP_PATH}" [ ! -d "${PORT_WINE_PATH}/data/" ] && mkdir "${PORT_WINE_PATH}/data/"
if [ "$?" = "0" ] ; then cp -fr "${PORT_WINE_TMP_PATH}/PortWINE-master/data_from_portwine/"* "${PORT_WINE_PATH}/data/"
[ ! -d "${PORT_WINE_PATH}/data/" ] && mkdir "${PORT_WINE_PATH}/data/" rm -f "${PORT_WINE_TMP_PATH}/PortWINE-master.tar.gz"
cp -fr "${PORT_WINE_TMP_PATH}/PortWINE-master/data_from_portwine/"* "${PORT_WINE_PATH}/data/" rm -fr "${PORT_WINE_TMP_PATH}/PortWINE-master/"
rm -f "${PORT_WINE_TMP_PATH}/PortWINE-master.tar.gz" export scripts_current_ver=$(cat "${PORT_WINE_PATH}/data/scripts/var" | grep SCRIPTS_NEXT_VERSION | awk -F "=" '{print $2}')
rm -fr "${PORT_WINE_TMP_PATH}/PortWINE-master/" echo "${scripts_current_ver}" > "${PORT_WINE_TMP_PATH}/scripts_ver"
export scripts_current_ver=`cat "${PORT_WINE_PATH}/data/scripts/var" | grep SCRIPTS_NEXT_VERSION | awk -F "=" '{print $2}'` else
echo "${scripts_current_ver}" > "${PORT_WINE_TMP_PATH}/scripts_ver" rm -f "${PORT_WINE_TMP_PATH}/PortWINE-master.tar.gz"
else [ "$?" != "0" ] && echo "Fatal error! Exiting." && exit 1
rm -f "${PORT_WINE_TMP_PATH}/PortWINE-master.tar.gz"
try_download_scripts
fi
else
try_download_scripts
fi fi
} }
if [ "${PW_SILENT_INSTALL}" = "1" ] & [ ! -f "/usr/bin/portproton" ] ; then if [ "${PW_SILENT_INSTALL}" == "1" ] && [ ! -f "/usr/bin/portproton" ] ; then
try_download_scripts try_download_scripts
else else
try_download_scripts | progress_bar try_download_scripts | progress_bar
fi fi
chmod 755 -R "${PORT_WINE_PATH}"
######################################################################## ########################################################################
cd "${PORT_WINE_PATH}/data/scripts" cd "${PORT_WINE_PATH}/data/scripts"
/usr/bin/env bash "${PORT_WINE_PATH}/data/scripts/setup.sh" && exit 0 /usr/bin/env bash "${PORT_WINE_PATH}/data/scripts/setup.sh" && exit 0
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment