Update install.sh

This commit is contained in:
tuend-work
2025-11-12 22:26:50 +07:00
parent 543269d190
commit ea0e2503a1

View File

@@ -479,77 +479,77 @@ if [ ! -e /etc/ld.so.conf ] || [ "`grep -c -E '/usr/local/lib$' /etc/ld.so.conf`
ldconfig
fi
if [ "$OS" != "FreeBSD" ] && [ "$OS" != "debian" ]; then
if [ "${SYSTEMD}" = "yes" ]; then
if [ ! -s /etc/systemd/system/named.service ]; then
if [ -s /usr/lib/systemd/system/named.service ]; then
mv /usr/lib/systemd/system/named.service /etc/systemd/system/named.service
else
wget -O /etc/systemd/system/named.service ${SERVER}/custombuild/2.0/custombuild/configure/systemd/named.service
fi
fi
if [ ! -s /usr/lib/systemd/system/named-setup-rndc.service ]; then
wget -O /usr/lib/systemd/system/named-setup-rndc.service ${SERVER}/custombuild/2.0/custombuild/configure/systemd/named-setup-rndc.service
fi
# if [ "$OS" != "FreeBSD" ] && [ "$OS" != "debian" ]; then
# if [ "${SYSTEMD}" = "yes" ]; then
# if [ ! -s /etc/systemd/system/named.service ]; then
# if [ -s /usr/lib/systemd/system/named.service ]; then
# mv /usr/lib/systemd/system/named.service /etc/systemd/system/named.service
# else
# wget -O /etc/systemd/system/named.service ${SERVER}/custombuild/2.0/custombuild/configure/systemd/named.service
# fi
# fi
# if [ ! -s /usr/lib/systemd/system/named-setup-rndc.service ]; then
# wget -O /usr/lib/systemd/system/named-setup-rndc.service ${SERVER}/custombuild/2.0/custombuild/configure/systemd/named-setup-rndc.service
# fi
systemctl daemon-reload
systemctl enable named.service
else
mv -f /etc/init.d/named /etc/init.d/named.back
wget -O /etc/init.d/named http://www.directadmin.com/named
chmod 755 /etc/init.d/named
/sbin/chkconfig named reset
fi
# systemctl daemon-reload
# systemctl enable named.service
# else
# mv -f /etc/init.d/named /etc/init.d/named.back
# wget -O /etc/init.d/named http://www.directadmin.com/named
# chmod 755 /etc/init.d/named
# /sbin/chkconfig named reset
# fi
RNDCKEY=/etc/rndc.key
# RNDCKEY=/etc/rndc.key
if [ ! -s $RNDCKEY ]; then
echo "Generating new key: $RNDCKEY ...";
# if [ ! -s $RNDCKEY ]; then
# echo "Generating new key: $RNDCKEY ...";
if [ -e /dev/urandom ]; then
/usr/sbin/rndc-confgen -a -r /dev/urandom
else
/usr/sbin/rndc-confgen -a
fi
# if [ -e /dev/urandom ]; then
# /usr/sbin/rndc-confgen -a -r /dev/urandom
# else
# /usr/sbin/rndc-confgen -a
# fi
COUNT=`grep -c 'key "rndc-key"' $RNDCKEY`
if [ "$COUNT" -eq 1 ]; then
perl -pi -e 's/key "rndc-key"/key "rndckey"/' $RNDCKEY
fi
# COUNT=`grep -c 'key "rndc-key"' $RNDCKEY`
# if [ "$COUNT" -eq 1 ]; then
# perl -pi -e 's/key "rndc-key"/key "rndckey"/' $RNDCKEY
# fi
echo "Done generating new key";
fi
# echo "Done generating new key";
# fi
if [ ! -s $RNDCKEY ]; then
echo "rndc-confgen failed. Using template instead.";
# if [ ! -s $RNDCKEY ]; then
# echo "rndc-confgen failed. Using template instead.";
wget -O $RNDCKEY http://www.directadmin.com/rndc.key
# wget -O $RNDCKEY http://www.directadmin.com/rndc.key
if [ `cat $RNDCKEY | grep -c secret` -eq 0 ]; then
SECRET=`/usr/sbin/rndc-confgen | grep secret | head -n 1`
STR="perl -pi -e 's#hmac-md5;#hmac-md5;\n\t$SECRET#' $RNDCKEY;"
eval $STR;
fi
# if [ `cat $RNDCKEY | grep -c secret` -eq 0 ]; then
# SECRET=`/usr/sbin/rndc-confgen | grep secret | head -n 1`
# STR="perl -pi -e 's#hmac-md5;#hmac-md5;\n\t$SECRET#' $RNDCKEY;"
# eval $STR;
# fi
echo "Template installed.";
fi
# echo "Template installed.";
# fi
chown named:named ${RNDCKEY}
fi
# chown named:named ${RNDCKEY}
# fi
if [ -e /etc/sysconfig/named ]; then
/usr/bin/perl -pi -e 's/^ROOTDIR=.*/ROOTDIR=/' /etc/sysconfig/named
fi
# if [ -e /etc/sysconfig/named ]; then
# /usr/bin/perl -pi -e 's/^ROOTDIR=.*/ROOTDIR=/' /etc/sysconfig/named
# fi
if [ $SSL_DEVEL -eq 0 ]; then
echo "";
echo "";
echo "Cannot find ${SSL_H}.";
echo "Did you run the pre-install commands?";
echo "http://help.directadmin.com/item.php?id=354";
echo "";
exit 12;
fi
# if [ $SSL_DEVEL -eq 0 ]; then
# echo "";
# echo "";
# echo "Cannot find ${SSL_H}.";
# echo "Did you run the pre-install commands?";
# echo "http://help.directadmin.com/item.php?id=354";
# echo "";
# exit 12;
# fi
if [ $OS != "FreeBSD" ]; then
groupadd apache >/dev/null 2>&1
@@ -597,7 +597,7 @@ if [ -x $DATE_BIN ]; then
echo "'$NOW' is not a valid integer. Check the '$DATE_BIN +%s' command";
fi
fi
touch /root/.skip_mysql_install
#setup a basic my.cnf file.
MYCNF=/etc/my.cnf
if [ ! -e /root/.skip_mysql_install ]; then