Commit 280cb390 authored by Mikhail Tergoev's avatar Mikhail Tergoev

added main installation script

parent 5de97e18
#!/bin/sh
########################################################################
export gamedir="DIRNAME"
export gamename="NAME"
export portname="PortNAME"
export port_ver="XX"
########################################################################
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 "root? realy?" && zenity --error --text "root? realy?" && exit 1
########################################################################
SET_LANG=`zenity --title "Install $portname" --text "Select the installation language \nВыберите язык установки" --list --radiolist \
--column="Set (Выбор)" --column "Language (Язык):" \
TRUE "Русский" \
FALSE "English" `
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. \nThe author assumes no liability for this software! \nContinuing the installation of you agree to these terms." ;;
esac
`zenity --info --title "INFO" --text "$INFO_TEXT" --no-wrap `
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 "Другой путь..." `
if [ $? -eq 1 ];then exit 1; fi
case $inst1 in
"${deflink}")
D_PATH="${deflink}" ;;
"Другой путь...")
D_PATH=`zenity --file-selection --directory --title="Выберите путь..." ` ;;
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..." `
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..." ` ;;
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
} ;;
"English")
zen() {
zenity --progress --title="Install..." --text="Install ${portname}" --pulsate --auto-close --auto-kill --width=450
} ;;
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
rm -fR "${PORT_WINE_PATH}/data/wine"
rm -fR "${PORT_WINE_PATH}/data/tmp"
rm -fR "${PORT_WINE_PATH}/data/img"
rm -fR "${PORT_WINE_PATH}/data/scripts"
rm -fR "${PORT_WINE_PATH}/data/prefix/reg.user"
# rm -fR "${PORT_WINE_PATH}/data/prefix/drive_c/users"
rm -fR "${PORT_WINE_PATH}/data/prefix/drive_c/windows"
if [ -d "${PORT_WINE_PATH}/data/prefix/drive_c/Games" ]
then
rm -fR "${PORT_WINE_PATH}/data/prefix/drive_c/Program Files"
if [ -d "${PORT_WINE_PATH}/data/prefix/drive_c/Games/${gamedir}" ]
then
mv -f "${PORT_WINE_PATH}/data/prefix/drive_c/Games/${gamedir}" "${PORT_WINE_PATH}/data/prefix/drive_c/Games/${gamedir}_old"
fi
else
if [ -d "${PORT_WINE_PATH}/data/prefix/drive_c/Program Files/${gamedir}" ]
then
mv -f "${PORT_WINE_PATH}/data/prefix/drive_c/Program Files/${gamedir}" "${PORT_WINE_PATH}/data/prefix/drive_c/Program Files/${gamedir}_old"
fi
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 +159 "${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,158p "${links}/${setup_script}" > "${PORT_WINE_PATH}/data/tmp/${setup_script}"
########################################################################
if [ -d "${PORT_WINE_PATH}/data/prefix/drive_c/Games/${gamedir}_old" ]
then
rm -fR "${PORT_WINE_PATH}/data/prefix/drive_c/Games/${gamedir}"
mv -f "${PORT_WINE_PATH}/data/prefix/drive_c/Games/${gamedir}_old" "${PORT_WINE_PATH}/data/prefix/drive_c/Games/${gamedir}"
fi
if [ -d "${PORT_WINE_PATH}/data/prefix/drive_c/Program Files/${gamedir}_old" ]
then
rm -fR "${PORT_WINE_PATH}/data/prefix/drive_c/Program Files/${gamedir}"
mv -f "${PORT_WINE_PATH}/data/prefix/drive_c/Program Files/${gamedir}_old" "${PORT_WINE_PATH}/data/prefix/drive_c/Program Files/${gamedir}"
fi
if [ -d "${PORT_WINE_PATH}/data/prefix/drive_c/Games/${gamedir}" ]
then
rm -fR "${PORT_WINE_PATH}/data/prefix/drive_c/Games/${gamedir}_rus"
rm -fR "${PORT_WINE_PATH}/data/prefix/drive_c/Games/${gamedir}_eng"
elif [ -d "${PORT_WINE_PATH}/data/prefix/drive_c/Games/${gamedir}_rus" ]
then
if [ "${update_loc}" = "RUS" ]
then
mv -f "${PORT_WINE_PATH}/data/prefix/drive_c/Games/${gamedir}_rus" "${PORT_WINE_PATH}/data/prefix/drive_c/Games/${gamedir}"
rm -fR "${PORT_WINE_PATH}/data/prefix/drive_c/Games/${gamedir}_eng"
else
mv -f "${PORT_WINE_PATH}/data/prefix/drive_c/Games/${gamedir}_eng" "${PORT_WINE_PATH}/data/prefix/drive_c/Games/${gamedir}"
rm -fR "${PORT_WINE_PATH}/data/prefix/drive_c/Games/${gamedir}_rus"
fi
fi
if [ -d "${PORT_WINE_PATH}/data/prefix/drive_c/Program Files/${gamedir}" ]
then
rm -fR "${PORT_WINE_PATH}/data/prefix/drive_c/Program Files/${gamedir}_rus"
rm -fR "${PORT_WINE_PATH}/data/prefix/drive_c/Program Files/${gamedir}_eng"
elif [ -d "${PORT_WINE_PATH}/data/prefix/drive_c/Program Files/${gamedir}_rus" ]
then
if [ "${update_loc}" = "RUS" ]
then
mv -f "${PORT_WINE_PATH}/data/prefix/drive_c/Program Files/${gamedir}_rus" "${PORT_WINE_PATH}/data/prefix/drive_c/Program Files/${gamedir}"
rm -fR "${PORT_WINE_PATH}/data/prefix/drive_c/Program Files/${gamedir}_eng"
else
mv -f "${PORT_WINE_PATH}/data/prefix/drive_c/Program Files/${gamedir}_eng" "${PORT_WINE_PATH}/data/prefix/drive_c/Program Files/${gamedir}"
rm -fR "${PORT_WINE_PATH}/data/prefix/drive_c/Program Files/${gamedir}_rus"
fi
fi
########################################################################
cd "${PORT_WINE_PATH}/data/scripts"
sh "${PORT_WINE_PATH}/data/scripts/setup" && exit 0
################################ARCH_BIN################################
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