Просмотр исходного кода

Changes to how the mysqlclient gets installed, if user cannot use sudo it will warn the user about doing it after the installation

Chaos 9 лет назад
Родитель
Сommit
9052fbb139
1 измененных файлов с 14 добавлено и 5 удалено
  1. 14 5
      lgsm/functions/install_mta_resources.sh

+ 14 - 5
lgsm/functions/install_mta_resources.sh

@@ -15,11 +15,20 @@ fn_install_libmysqlclient16(){
 	echo "================================="
 	sleep 1
 	if [ ! -f /usr/lib/libmysqlclient.so.16 ]; then
-		echo "libmysqlclient16 not installed. Installing.."
-    fileurl="https://nightly.mtasa.com/files/modules/64/libmysqlclient.so.16"; filedir="/usr/lib/"; filename="libmysqlclient.so.16"; executecmd="noexecute" run="norun"; force="noforce"; md5="6c188e0f8fb5d7a29f4bc413b9fed6c2"
-    fn_fetch_file "${fileurl}" "${filedir}" "${filename}" "${executecmd}" "${run}" "${force}" "${md5}"
+		fn_print_warn "libmysqlclient16 not installed. Installing.."
+		sleep 1
+		sudo -v > /dev/null 2>&1
+		if [ $? -eq 0 ]; then
+    	fileurl="https://nightly.mtasa.com/files/modules/64/libmysqlclient.so.16"; filedir="${tmpdir}"; filename="libmysqlclient.so.16"; executecmd="executecmd" run="norun"; force="noforce"; md5="6c188e0f8fb5d7a29f4bc413b9fed6c2"
+    	fn_fetch_file "${fileurl}" "${filedir}" "${filename}" "${executecmd}" "${run}" "${force}" "${md5}"
+			sudo mv ${tmpdir}/${filename} /usr/lib/${filename}
+		else
+			fn_print_fail_nl "Failed to install libmysqlclient16, $(whoami) does not have sudo access. Download it manually and place it in /usr/lib"
+			sleep 1
+		fi
+	else
+  	echo "libmysqlclient16 already installed."
 	fi
-  echo "libmysqlclient16 installed."
 }
 
 fn_install_resources(){
@@ -37,7 +46,7 @@ fn_install_libmysqlclient16
 if [ -z "${autoinstall}" ]; then
 	echo ""
 	while true; do
-		read -e -i "n" -p "Do you want to have the default resources downloaded? (Server is inoperable without resources!) [y/N]" yn
+		read -e -i "y" -p "Do you want to have the default resources downloaded? (Server is inoperable without resources!) [y/N]" yn
 		case $yn in
 		[Yy]* ) fn_install_resources && break;;
 		[Nn]* ) break;;