init
This commit is contained in:
@@ -0,0 +1,138 @@
|
||||
#!/bin/bash
|
||||
# Author: yeho <lj2007331 AT gmail.com>
|
||||
# BLOG: https://linuxeye.com
|
||||
#
|
||||
# Notes: OneinStack for CentOS/RedHat 7+ Debian 9+ and Ubuntu 16+
|
||||
#
|
||||
# Project home page:
|
||||
# https://oneinstack.com
|
||||
# https://github.com/oneinstack/oneinstack
|
||||
|
||||
Upgrade_DB() {
|
||||
pushd ${oneinstack_dir}/src > /dev/null
|
||||
[ ! -e "${db_install_dir}/bin/mysql" ] && echo "${CWARNING}MySQL/MariaDB is not installed on your system! ${CEND}" && exit 1
|
||||
[ "${armplatform}" == 'y' ] && echo "${CWARNING}The arm architecture operating system does not support upgrading MySQL/MariaDB! ${CEND}" && exit 1
|
||||
|
||||
# check db passwd
|
||||
while :; do
|
||||
${db_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "quit" > /dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
break
|
||||
else
|
||||
echo
|
||||
read -e -p "Please input the root password of database: " NEW_dbrootpwd
|
||||
${db_install_dir}/bin/mysql -uroot -p${NEW_dbrootpwd} -e "quit" >/dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
dbrootpwd=${NEW_dbrootpwd}
|
||||
sed -i "s+^dbrootpwd.*+dbrootpwd='$dbrootpwd'+" ../config/options.conf
|
||||
break
|
||||
else
|
||||
echo "${CFAILURE}${DB} root password incorrect,Please enter again! ${CEND}"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
OLD_db_ver_tmp=`${db_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e 'select version()\G;' | grep version | awk '{print $2}'`
|
||||
if [ -n "`${db_install_dir}/bin/mysql -V | grep -o MariaDB`" ]; then
|
||||
[ "${IPADDR_COUNTRY}"x == "CN"x ] && DOWN_ADDR=https://mirrors.tuna.tsinghua.edu.cn/mariadb || DOWN_ADDR=https://downloads.mariadb.org/f
|
||||
DB=MariaDB
|
||||
OLD_db_ver=`echo ${OLD_db_ver_tmp} | awk -F'-' '{print $1}'`
|
||||
else
|
||||
[ "${IPADDR_COUNTRY}"x == "CN"x ] && DOWN_ADDR=http://mirrors.ustc.edu.cn/mysql-ftp/Downloads || DOWN_ADDR=http://cdn.mysql.com/Downloads
|
||||
DB=MySQL
|
||||
OLD_db_ver=${OLD_db_ver_tmp%%-log}
|
||||
fi
|
||||
|
||||
#backup
|
||||
echo
|
||||
echo "${CSUCCESS}Starting ${DB} backup${CEND}......"
|
||||
${db_install_dir}/bin/mysqldump -uroot -p${dbrootpwd} --opt --all-databases > DB_all_backup_$(date +"%Y%m%d").sql
|
||||
[ -f "DB_all_backup_$(date +"%Y%m%d").sql" ] && echo "${DB} backup success, Backup file: ${MSG}`pwd`/DB_all_backup_$(date +"%Y%m%d").sql${CEND}"
|
||||
|
||||
#upgrade
|
||||
echo
|
||||
echo "Current ${DB} Version: ${CMSG}${OLD_db_ver}${CEND}"
|
||||
while :; do echo
|
||||
[ "${db_flag}" != 'y' ] && read -e -p "Please input upgrade ${DB} Version(example: ${OLD_db_ver}): " NEW_db_ver
|
||||
if [ `echo ${NEW_db_ver} | awk -F. '{print $1"."$2}'` == `echo ${OLD_db_ver} | awk -F. '{print $1"."$2}'` ]; then
|
||||
if [ "${DB}" == 'MariaDB' ]; then
|
||||
DB_filename=mariadb-${NEW_db_ver}-linux-systemd-x86_64
|
||||
DB_URL=${DOWN_ADDR}/mariadb-${NEW_db_ver}/bintar-linux-systemd-x86_64/${DB_filename}.tar.gz
|
||||
elif [ "${DB}" == 'MySQL' ]; then
|
||||
DB_filename=mysql-${NEW_db_ver}-linux-glibc2.12-x86_64
|
||||
if [ `echo ${OLD_db_ver} | awk -F. '{print $1"."$2}'` == '8.0' ]; then
|
||||
DB_URL=${DOWN_ADDR}/MySQL-`echo ${NEW_db_ver} | awk -F. '{print $1"."$2}'`/${DB_filename}.tar.xz
|
||||
else
|
||||
DB_URL=${DOWN_ADDR}/MySQL-`echo ${NEW_db_ver} | awk -F. '{print $1"."$2}'`/${DB_filename}.tar.gz
|
||||
fi
|
||||
fi
|
||||
[ ! -e "`ls ${DB_filename}.tar.?z 2>/dev/null`" ] && wget --no-check-certificate -c ${DB_URL} > /dev/null 2>&1
|
||||
if [ -e "`ls ${DB_filename}.tar.?z 2>/dev/null`" ]; then
|
||||
echo "Download [${CMSG}`ls ${DB_filename}.tar.?z 2>/dev/null`${CEND}] successfully! "
|
||||
else
|
||||
echo "${CWARNING}${DB} version does not exist! ${CEND}"
|
||||
fi
|
||||
break
|
||||
else
|
||||
echo "${CWARNING}input error! ${CEND}Please only input '${CMSG}${OLD_db_ver%.*}.xx${CEND}'"
|
||||
[ "${db_flag}" == 'y' ] && exit
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -e "`ls ${DB_filename}.tar.?z 2>/dev/null`" ]; then
|
||||
echo "[${CMSG}`ls ${DB_filename}.tar.?z 2>/dev/null`${CEND}] found"
|
||||
if [ "${db_flag}" != 'y' ]; then
|
||||
echo "Press Ctrl+c to cancel or Press any key to continue..."
|
||||
char=`get_char`
|
||||
fi
|
||||
if [ "${DB}" == 'MariaDB' ]; then
|
||||
tar xzf ${DB_filename}.tar.gz
|
||||
service mysqld stop
|
||||
mv ${mariadb_install_dir}{,_old_`date +"%Y%m%d_%H%M%S"`}
|
||||
mv ${mariadb_data_dir}{,_old_`date +"%Y%m%d_%H%M%S"`}
|
||||
[ ! -d "${mariadb_install_dir}" ] && mkdir -p ${mariadb_install_dir}
|
||||
mkdir -p ${mariadb_data_dir};chown mysql.mysql -R ${mariadb_data_dir}
|
||||
mv ${DB_filename}/* ${mariadb_install_dir}/
|
||||
sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libjemalloc.so@' ${mariadb_install_dir}/bin/mysqld_safe
|
||||
${mariadb_install_dir}/scripts/mysql_install_db --user=mysql --basedir=${mariadb_install_dir} --datadir=${mariadb_data_dir}
|
||||
chown mysql.mysql -R ${mariadb_data_dir}
|
||||
service mysqld start
|
||||
${mariadb_install_dir}/bin/mysql < DB_all_backup_$(date +"%Y%m%d").sql
|
||||
service mysqld restart
|
||||
${mariadb_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "drop database test;" >/dev/null 2>&1
|
||||
${mariadb_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "reset master;" >/dev/null 2>&1
|
||||
${mariadb_install_dir}/bin/mysql_upgrade -uroot -p${dbrootpwd} >/dev/null 2>&1
|
||||
[ $? -eq 0 ] && echo "You have ${CMSG}successfully${CEND} upgrade from ${CMSG}${OLD_db_ver}${CEND} to ${CMSG}${NEW_db_ver}${CEND}"
|
||||
elif [ "${DB}" == 'MySQL' ]; then
|
||||
if [ `echo ${OLD_db_ver} | awk -F. '{print $1"."$2}'` == '8.0' ]; then
|
||||
tar xJf ${DB_filename}.tar.xz
|
||||
else
|
||||
tar xzf ${DB_filename}.tar.gz
|
||||
fi
|
||||
service mysqld stop
|
||||
mv ${mysql_install_dir}{,_old_`date +"%Y%m%d_%H%M%S"`}
|
||||
mv ${mysql_data_dir}{,_old_`date +"%Y%m%d_%H%M%S"`}
|
||||
[ ! -d "${mysql_install_dir}" ] && mkdir -p ${mysql_install_dir}
|
||||
mkdir -p ${mysql_data_dir};chown mysql.mysql -R ${mysql_data_dir}
|
||||
mv ${DB_filename}/* ${mysql_install_dir}/
|
||||
sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libjemalloc.so@' ${mysql_install_dir}/bin/mysqld_safe
|
||||
sed -i "s@/usr/local/mysql@${mysql_install_dir}@g" ${mysql_install_dir}/bin/mysqld_safe
|
||||
if [[ "`echo ${NEW_db_ver} | awk -F. '{print $1"."$2}'`" =~ ^5.[5-6]$ ]]; then
|
||||
${mysql_install_dir}/scripts/mysql_install_db --user=mysql --basedir=${mysql_install_dir} --datadir=${mysql_data_dir}
|
||||
else
|
||||
${mysql_install_dir}/bin/mysqld --initialize-insecure --user=mysql --basedir=${mysql_install_dir} --datadir=${mysql_data_dir}
|
||||
fi
|
||||
|
||||
chown mysql.mysql -R ${mysql_data_dir}
|
||||
[ -e "${mysql_install_dir}/my.cnf" ] && rm -rf ${mysql_install_dir}/my.cnf
|
||||
sed -i '/myisam_repair_threads/d' /etc/my.cnf
|
||||
service mysqld start
|
||||
${mysql_install_dir}/bin/mysql < DB_all_backup_$(date +"%Y%m%d").sql
|
||||
service mysqld restart
|
||||
${mysql_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "drop database test;" >/dev/null 2>&1
|
||||
${mysql_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "reset master;" >/dev/null 2>&1
|
||||
${mysql_install_dir}/bin/mysql_upgrade -uroot -p${dbrootpwd} >/dev/null 2>&1
|
||||
[ $? -eq 0 ] && echo "You have ${CMSG}successfully${CEND} upgrade from ${CMSG}${OLD_db_ver}${CEND} to ${CMSG}${NEW_db_ver}${CEND}"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
#!/bin/bash
|
||||
# Author: yeho <lj2007331 AT gmail.com>
|
||||
# BLOG: https://linuxeye.com
|
||||
#
|
||||
# Notes: OneinStack for CentOS/RedHat 7+ Debian 9+ and Ubuntu 16+
|
||||
#
|
||||
# Project home page:
|
||||
# https://oneinstack.com
|
||||
# https://github.com/oneinstack/oneinstack
|
||||
|
||||
Upgrade_OneinStack() {
|
||||
pushd ${oneinstack_dir} > /dev/null
|
||||
Latest_OneinStack_MD5=$(curl --connect-timeout 3 -m 5 -s http://mirrors.linuxeye.com/md5sum.txt | grep oneinstack.tar.gz | awk '{print $1}')
|
||||
[ ! -e README.md ] && ois_flag=n
|
||||
if [ "${oneinstack_md5}" != "${Latest_OneinStack_MD5}" ]; then
|
||||
/bin/mv config/options.conf /tmp
|
||||
sed -i '/oneinstack_dir=/d' /tmp/config/options.conf
|
||||
[ -e /tmp/oneinstack.tar.gz ] && rm -rf /tmp/oneinstack.tar.gz
|
||||
wget -qc http://mirrors.linuxeye.com/oneinstack.tar.gz -O /tmp/oneinstack.tar.gz
|
||||
if [ -n "`echo ${oneinstack_dir} | grep lnmp`" ]; then
|
||||
tar xzf /tmp/oneinstack.tar.gz -C /tmp
|
||||
/bin/cp -R /tmp/oneinstack/* ${oneinstack_dir}/
|
||||
/bin/rm -rf /tmp/oneinstack
|
||||
else
|
||||
tar xzf /tmp/oneinstack.tar.gz -C ../
|
||||
fi
|
||||
IFS=$'\n'
|
||||
for L in `grep -vE '^#|^$' /tmp/config/options.conf`
|
||||
do
|
||||
IFS=$IFS_old
|
||||
Key="`echo ${L%%=*}`"
|
||||
Value="`echo ${L#*=}`"
|
||||
sed -i "s|^${Key}=.*|${Key}=${Value}|" ./config/options.conf
|
||||
done
|
||||
rm -rf /tmp/{oneinstack.tar.gz,config/options.conf}
|
||||
[ "${ois_flag}" == "n" ] && rm -f ss.sh LICENSE README.md
|
||||
sed -i "s@^oneinstack_md5=.*@oneinstack_md5=${Latest_OneinStack_MD5}@" ./config/options.conf
|
||||
if [ -e "${php_install_dir}/sbin/php-fpm" ]; then
|
||||
[ -n "`grep ^cgi.fix_pathinfo=0 ${php_install_dir}/etc/php.ini`" ] && sed -i 's@^cgi.fix_pathinfo.*@;&@' ${php_install_dir}/etc/php.ini
|
||||
[ -e "/usr/local/php53/etc/php.ini" ] && sed -i 's@^cgi.fix_pathinfo=0@;&@' /usr/local/php53/etc/php.ini 2>/dev/null
|
||||
[ -e "/usr/local/php54/etc/php.ini" ] && sed -i 's@^cgi.fix_pathinfo=0@;&@' /usr/local/php54/etc/php.ini 2>/dev/null
|
||||
[ -e "/usr/local/php55/etc/php.ini" ] && sed -i 's@^cgi.fix_pathinfo=0@;&@' /usr/local/php55/etc/php.ini 2>/dev/null
|
||||
[ -e "/usr/local/php56/etc/php.ini" ] && sed -i 's@^cgi.fix_pathinfo=0@;&@' /usr/local/php56/etc/php.ini 2>/dev/null
|
||||
[ -e "/usr/local/php70/etc/php.ini" ] && sed -i 's@^cgi.fix_pathinfo=0@;&@' /usr/local/php70/etc/php.ini 2>/dev/null
|
||||
[ -e "/usr/local/php71/etc/php.ini" ] && sed -i 's@^cgi.fix_pathinfo=0@;&@' /usr/local/php71/etc/php.ini 2>/dev/null
|
||||
[ -e "/usr/local/php72/etc/php.ini" ] && sed -i 's@^cgi.fix_pathinfo=0@;&@' /usr/local/php72/etc/php.ini 2>/dev/null
|
||||
[ -e "/usr/local/php73/etc/php.ini" ] && sed -i 's@^cgi.fix_pathinfo=0@;&@' /usr/local/php73/etc/php.ini 2>/dev/null
|
||||
[ -e "/usr/local/php74/etc/php.ini" ] && sed -i 's@^cgi.fix_pathinfo=0@;&@' /usr/local/php74/etc/php.ini 2>/dev/null
|
||||
[ -e "/usr/local/php80/etc/php.ini" ] && sed -i 's@^cgi.fix_pathinfo=0@;&@' /usr/local/php80/etc/php.ini 2>/dev/null
|
||||
[ -e "/usr/local/php81/etc/php.ini" ] && sed -i 's@^cgi.fix_pathinfo=0@;&@' /usr/local/php81/etc/php.ini 2>/dev/null
|
||||
fi
|
||||
[ -e "/lib/systemd/system/php-fpm.service" ] && { sed -i 's@^PrivateTmp.*@#&@g' /lib/systemd/system/php-fpm.service; systemctl daemon-reload; }
|
||||
echo
|
||||
echo "${CSUCCESS}Congratulations! OneinStack upgrade successful! ${CEND}"
|
||||
echo
|
||||
else
|
||||
echo "${CWARNING}Your OneinStack already has the latest version or does not need to be upgraded! ${CEND}"
|
||||
fi
|
||||
popd > /dev/null
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
#!/bin/bash
|
||||
# Author: yeho <lj2007331 AT gmail.com>
|
||||
# BLOG: https://linuxeye.com
|
||||
#
|
||||
# Notes: OneinStack for CentOS/RedHat 7+ Debian 9+ and Ubuntu 16+
|
||||
#
|
||||
# Project home page:
|
||||
# https://oneinstack.com
|
||||
# https://github.com/oneinstack/oneinstack
|
||||
|
||||
Upgrade_PHP() {
|
||||
pushd ${oneinstack_dir}/src > /dev/null
|
||||
[ ! -e "${php_install_dir}" ] && echo "${CWARNING}PHP is not installed on your system! ${CEND}" && exit 1
|
||||
OLD_php_ver=`${php_install_dir}/bin/php-config --version`
|
||||
Latest_php_ver=`curl --connect-timeout 2 -m 3 -s https://www.php.net/releases/active.php | python -mjson.tool | awk '/version/{print $2}' | sed 's/"//g' | grep "${OLD_php_ver%.*}"`
|
||||
Latest_php_ver=${Latest_php_ver:-8.1.12}
|
||||
echo
|
||||
echo "Current PHP Version: ${CMSG}$OLD_php_ver${CEND}"
|
||||
while :; do echo
|
||||
[ "${php_flag}" != 'y' ] && read -e -p "Please input upgrade PHP Version(Default: $Latest_php_ver): " NEW_php_ver
|
||||
NEW_php_ver=${NEW_php_ver:-${Latest_php_ver}}
|
||||
if [ "${NEW_php_ver%.*}" == "${OLD_php_ver%.*}" ]; then
|
||||
[ ! -e "php-${NEW_php_ver}.tar.gz" ] && wget --no-check-certificate -c https://secure.php.net/distributions/php-${NEW_php_ver}.tar.gz > /dev/null 2>&1
|
||||
if [ -e "php-${NEW_php_ver}.tar.gz" ]; then
|
||||
echo "Download [${CMSG}php-${NEW_php_ver}.tar.gz${CEND}] successfully! "
|
||||
else
|
||||
echo "${CWARNING}PHP version does not exist! ${CEND}"
|
||||
fi
|
||||
break
|
||||
else
|
||||
echo "${CWARNING}input error! ${CEND}Please only input '${CMSG}${OLD_php_ver%.*}.xx${CEND}'"
|
||||
[ "${php_flag}" == 'y' ] && exit
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -e "php-${NEW_php_ver}.tar.gz" ]; then
|
||||
echo "[${CMSG}php-${NEW_php_ver}.tar.gz${CEND}] found"
|
||||
if [ "${php_flag}" != 'y' ]; then
|
||||
echo "Press Ctrl+c to cancel or Press any key to continue..."
|
||||
char=`get_char`
|
||||
fi
|
||||
tar xzf php-${NEW_php_ver}.tar.gz
|
||||
if [[ "${OLD_php_ver%.*}" =~ ^5.[3-6]$ ]]; then
|
||||
src_url=http://mirrors.linuxeye.com/oneinstack/src/fpm-race-condition.patch && Download_src
|
||||
patch -d php-${NEW_php_ver} -p0 < fpm-race-condition.patch
|
||||
fi
|
||||
pushd php-${NEW_php_ver}
|
||||
if [[ "${OLD_php_ver%.*}" =~ ^7.[1-4]$|^8.[0-1]$ ]] && [ -e ext/openssl/openssl.c ] && ! grep -Eqi '^#ifdef RSA_SSLV23_PADDING' ext/openssl/openssl.c; then
|
||||
sed -i '/OPENSSL_SSLV23_PADDING/i#ifdef RSA_SSLV23_PADDING' ext/openssl/openssl.c
|
||||
sed -i '/OPENSSL_SSLV23_PADDING/a#endif' ext/openssl/openssl.c
|
||||
fi
|
||||
make clean
|
||||
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig/:$PKG_CONFIG_PATH
|
||||
${php_install_dir}/bin/php -i |grep 'Configure Command' | awk -F'=>' '{print $2}' | bash
|
||||
make ZEND_EXTRA_LIBS='-liconv' -j ${THREAD}
|
||||
echo "Stoping php-fpm..."
|
||||
service php-fpm stop
|
||||
make install
|
||||
echo "Starting php-fpm..."
|
||||
service php-fpm start
|
||||
popd > /dev/null
|
||||
echo "You have ${CMSG}successfully${CEND} upgrade from ${CWARNING}$OLD_php_ver${CEND} to ${CWARNING}${NEW_php_ver}${CEND}"
|
||||
rm -rf php-${NEW_php_ver}
|
||||
fi
|
||||
popd > /dev/null
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
#!/bin/bash
|
||||
# Author: yeho <lj2007331 AT gmail.com>
|
||||
# BLOG: https://linuxeye.com
|
||||
#
|
||||
# Notes: OneinStack for CentOS/RedHat 7+ Debian 9+ and Ubuntu 16+
|
||||
#
|
||||
# Project home page:
|
||||
# https://oneinstack.com
|
||||
# https://github.com/oneinstack/oneinstack
|
||||
|
||||
Upgrade_phpMyAdmin() {
|
||||
pushd ${oneinstack_dir}/src > /dev/null
|
||||
[ ! -e "${wwwroot_dir}/default/phpMyAdmin" ] && echo "${CWARNING}phpMyAdmin is not installed on your system! ${CEND}" && exit 1
|
||||
OLD_phpmyadmin_ver=`grep Version ${wwwroot_dir}/default/phpMyAdmin/README | awk '{print $2}'`
|
||||
Latest_phpmyadmin_ver=`curl --connect-timeout 2 -m 3 -s https://www.phpmyadmin.net/files/ | awk -F'>|<' '/\/files\/[0-9]/{print $5}' | head -1`
|
||||
Latest_phpmyadmin_ver=${Latest_phpmyadmin_ver:-5.0.4}
|
||||
echo "Current phpMyAdmin Version: ${CMSG}${OLD_phpmyadmin_ver}${CEND}"
|
||||
while :; do echo
|
||||
[ "${phpmyadmin_flag}" != 'y' ] && read -e -p "Please input upgrade phpMyAdmin Version(default: ${Latest_phpmyadmin_ver}): " NEW_phpmyadmin_ver
|
||||
NEW_phpmyadmin_ver=${NEW_phpmyadmin_ver:-${Latest_phpmyadmin_ver}}
|
||||
if [ "${NEW_phpmyadmin_ver}" != "${OLD_phpmyadmin_ver}" ]; then
|
||||
[ ! -e "phpMyAdmin-${NEW_phpmyadmin_ver}-all-languages.tar.gz" ] && wget --no-check-certificate -c https://files.phpmyadmin.net/phpMyAdmin/${NEW_phpmyadmin_ver}/phpMyAdmin-${NEW_phpmyadmin_ver}-all-languages.tar.gz > /dev/null 2>&1
|
||||
if [ -e "phpMyAdmin-${NEW_phpmyadmin_ver}-all-languages.tar.gz" ]; then
|
||||
echo "Download [${CMSG}phpMyAdmin-${NEW_phpmyadmin_ver}-all-languages.tar.gz${CEND}] successfully! "
|
||||
break
|
||||
else
|
||||
echo "${CWARNING}phpMyAdmin version does not exist! ${CEND}"
|
||||
fi
|
||||
else
|
||||
echo "${CWARNING}input error! Upgrade phpMyAdmin version is the same as the old version${CEND}"
|
||||
exit
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -e "phpMyAdmin-${NEW_phpmyadmin_ver}-all-languages.tar.gz" ]; then
|
||||
echo "[${CMSG}phpMyAdmin-${NEW_phpmyadmin_ver}-all-languages.tar.gz${CEND}] found"
|
||||
if [ "${phpmyadmin_flag}" != 'y' ]; then
|
||||
echo "Press Ctrl+c to cancel or Press any key to continue..."
|
||||
char=`get_char`
|
||||
fi
|
||||
tar xzf phpMyAdmin-${NEW_phpmyadmin_ver}-all-languages.tar.gz
|
||||
rm -rf ${wwwroot_dir}/default/phpMyAdmin
|
||||
/bin/mv phpMyAdmin-${NEW_phpmyadmin_ver}-all-languages ${wwwroot_dir}/default/phpMyAdmin
|
||||
/bin/cp ${wwwroot_dir}/default/phpMyAdmin/{config.sample.inc.php,config.inc.php}
|
||||
mkdir ${wwwroot_dir}/default/phpMyAdmin/{upload,save}
|
||||
sed -i "s@UploadDir.*@UploadDir'\] = 'upload';@" ${wwwroot_dir}/default/phpMyAdmin/config.inc.php
|
||||
sed -i "s@SaveDir.*@SaveDir'\] = 'save';@" ${wwwroot_dir}/default/phpMyAdmin/config.inc.php
|
||||
sed -i "s@host'\].*@host'\] = '127.0.0.1';@" ${wwwroot_dir}/default/phpMyAdmin/config.inc.php
|
||||
sed -i "s@blowfish_secret.*;@blowfish_secret\'\] = \'$(cat /dev/urandom | head -1 | base64 | head -c 45)\';@" ${wwwroot_dir}/default/phpMyAdmin/config.inc.php
|
||||
chown -R ${run_user}:${run_group} ${wwwroot_dir}/default/phpMyAdmin
|
||||
echo "You have ${CMSG}successfully${CEND} upgrade from ${CWARNING}$OLD_phpmyadmin_ver${CEND} to ${CWARNING}$NEW_phpmyadmin_ver${CEND}"
|
||||
fi
|
||||
popd > /dev/null
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
#!/bin/bash
|
||||
# Author: yeho <lj2007331 AT gmail.com>
|
||||
# BLOG: https://linuxeye.com
|
||||
#
|
||||
# Notes: OneinStack for CentOS/RedHat 7+ Debian 9+ and Ubuntu 16+
|
||||
#
|
||||
# Project home page:
|
||||
# https://oneinstack.com
|
||||
# https://github.com/oneinstack/oneinstack
|
||||
|
||||
Upgrade_Redis() {
|
||||
pushd ${oneinstack_dir}/src > /dev/null
|
||||
[ ! -d "$redis_install_dir" ] && echo "${CWARNING}Redis is not installed on your system! ${CEND}" && exit 1
|
||||
OLD_redis_ver=`$redis_install_dir/bin/redis-cli --version | awk '{print $2}'`
|
||||
Latest_redis_ver=`curl --connect-timeout 2 -m 3 -s http://download.redis.io/redis-stable/00-RELEASENOTES | awk '/Released/{print $2}' | head -1`
|
||||
Latest_redis_ver=${Latest_redis_ver:-6.0.4}
|
||||
echo "Current Redis Version: ${CMSG}$OLD_redis_ver${CEND}"
|
||||
while :; do echo
|
||||
[ "${redis_flag}" != 'y' ] && read -e -p "Please input upgrade Redis Version(default: ${Latest_redis_ver}): " NEW_redis_ver
|
||||
NEW_redis_ver=${NEW_redis_ver:-${Latest_redis_ver}}
|
||||
if [ "$NEW_redis_ver" != "$OLD_redis_ver" ]; then
|
||||
[ ! -e "redis-$NEW_redis_ver.tar.gz" ] && wget --no-check-certificate -c http://download.redis.io/releases/redis-$NEW_redis_ver.tar.gz > /dev/null 2>&1
|
||||
if [ -e "redis-$NEW_redis_ver.tar.gz" ]; then
|
||||
echo "Download [${CMSG}redis-$NEW_redis_ver.tar.gz${CEND}] successfully! "
|
||||
break
|
||||
else
|
||||
echo "${CWARNING}Redis version does not exist! ${CEND}"
|
||||
fi
|
||||
else
|
||||
echo "${CWARNING}input error! Upgrade Redis version is the same as the old version${CEND}"
|
||||
exit
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -e "redis-$NEW_redis_ver.tar.gz" ]; then
|
||||
echo "[${CMSG}redis-$NEW_redis_ver.tar.gz${CEND}] found"
|
||||
if [ "${redis_flag}" != 'y' ]; then
|
||||
echo "Press Ctrl+c to cancel or Press any key to continue..."
|
||||
char=`get_char`
|
||||
fi
|
||||
tar xzf redis-$NEW_redis_ver.tar.gz
|
||||
pushd redis-$NEW_redis_ver
|
||||
make clean
|
||||
make -j ${THREAD}
|
||||
|
||||
if [ -f "src/redis-server" ]; then
|
||||
echo "Restarting Redis..."
|
||||
service redis-server stop
|
||||
/bin/cp src/{redis-benchmark,redis-check-aof,redis-check-rdb,redis-cli,redis-sentinel,redis-server} $redis_install_dir/bin/
|
||||
service redis-server start
|
||||
popd > /dev/null
|
||||
echo "You have ${CMSG}successfully${CEND} upgrade from ${CWARNING}$OLD_redis_ver${CEND} to ${CWARNING}$NEW_redis_ver${CEND}"
|
||||
rm -rf redis-$NEW_redis_ver
|
||||
else
|
||||
echo "${CFAILURE}Upgrade Redis failed! ${CEND}"
|
||||
fi
|
||||
fi
|
||||
popd > /dev/null
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
#!/bin/bash
|
||||
# Author: yeho <lj2007331 AT gmail.com>
|
||||
# BLOG: https://linuxeye.com
|
||||
#
|
||||
# Notes: OneinStack for CentOS/RedHat 7+ Debian 9+ and Ubuntu 16+
|
||||
#
|
||||
# Project home page:
|
||||
# https://oneinstack.com
|
||||
# https://github.com/oneinstack/oneinstack
|
||||
|
||||
Upgrade_Nginx() {
|
||||
pushd ${oneinstack_dir}/src > /dev/null
|
||||
[ ! -e "${nginx_install_dir}/sbin/nginx" ] && echo "${CWARNING}Nginx is not installed on your system! ${CEND}" && exit 1
|
||||
OLD_nginx_ver_tmp=`${nginx_install_dir}/sbin/nginx -v 2>&1`
|
||||
OLD_nginx_ver=${OLD_nginx_ver_tmp##*/}
|
||||
Latest_nginx_ver=`curl --connect-timeout 2 -m 3 -s http://nginx.org/en/CHANGES-1.22 | awk '/Changes with nginx/{print$0}' | awk '{print $4}' | head -1`
|
||||
[ -z "${Latest_nginx_ver}" ] && Latest_nginx_ver=`curl --connect-timeout 2 -m 3 -s http://nginx.org/en/CHANGES | awk '/Changes with nginx/{print$0}' | awk '{print $4}' | head -1`
|
||||
echo
|
||||
echo "Current Nginx Version: ${CMSG}${OLD_nginx_ver}${CEND}"
|
||||
while :; do echo
|
||||
[ "${nginx_flag}" != 'y' ] && read -e -p "Please input upgrade Nginx Version(default: ${Latest_nginx_ver}): " NEW_nginx_ver
|
||||
NEW_nginx_ver=${NEW_nginx_ver:-${Latest_nginx_ver}}
|
||||
if [ "${NEW_nginx_ver}" != "${OLD_nginx_ver}" ]; then
|
||||
[ ! -e "nginx-${NEW_nginx_ver}.tar.gz" ] && wget --no-check-certificate -c http://nginx.org/download/nginx-${NEW_nginx_ver}.tar.gz > /dev/null 2>&1
|
||||
if [ -e "nginx-${NEW_nginx_ver}.tar.gz" ]; then
|
||||
src_url=https://www.openssl.org/source/openssl-${openssl11_ver}.tar.gz && Download_src
|
||||
src_url=http://mirrors.linuxeye.com/oneinstack/src/pcre-${pcre_ver}.tar.gz && Download_src
|
||||
src_url=http://mirrors.linuxeye.com/oneinstack/src/ngx_devel_kit.tar.gz && Download_src
|
||||
src_url=http://mirrors.linuxeye.com/oneinstack/src/lua-nginx-module-${lua_nginx_module_ver}.tar.gz && Download_src
|
||||
tar xzf openssl-${openssl11_ver}.tar.gz
|
||||
tar xzf pcre-${pcre_ver}.tar.gz
|
||||
tar xzf ngx_devel_kit.tar.gz
|
||||
tar xzf lua-nginx-module-${lua_nginx_module_ver}.tar.gz
|
||||
echo "Download [${CMSG}nginx-${NEW_nginx_ver}.tar.gz${CEND}] successfully! "
|
||||
break
|
||||
else
|
||||
echo "${CWARNING}Nginx version does not exist! ${CEND}"
|
||||
fi
|
||||
else
|
||||
echo "${CWARNING}input error! Upgrade Nginx version is the same as the old version${CEND}"
|
||||
exit
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -e "nginx-${NEW_nginx_ver}.tar.gz" ]; then
|
||||
echo "[${CMSG}nginx-${NEW_nginx_ver}.tar.gz${CEND}] found"
|
||||
if [ "${nginx_flag}" != 'y' ]; then
|
||||
echo "Press Ctrl+c to cancel or Press any key to continue..."
|
||||
char=`get_char`
|
||||
fi
|
||||
${nginx_install_dir}/sbin/nginx -V &> $$
|
||||
nginx_configure_args_tmp=`cat $$ | grep 'configure arguments:' | awk -F: '{print $2}'`
|
||||
rm -rf $$
|
||||
nginx_configure_args=`echo ${nginx_configure_args_tmp} | sed "s@lua-nginx-module-\w.\w\+.\w\+ @lua-nginx-module-${lua_nginx_module_ver} @" | sed "s@lua-nginx-module @lua-nginx-module-${lua_nginx_module_ver} @" | sed "s@--with-openssl=../openssl-\w.\w.\w\+ @--with-openssl=../openssl-${openssl11_ver} @" | sed "s@--with-pcre=../pcre-\w.\w\+ @--with-pcre=../pcre-${pcre_ver} @"`
|
||||
if [ -n `echo $nginx_configure_args | grep lua-nginx-module` ]; then
|
||||
${oneinstack_dir}/upgrade.sh --oneinstack > /dev/null
|
||||
src_url=http://mirrors.linuxeye.com/oneinstack/src/luajit2-${luajit2_ver}.tar.gz && Download_src
|
||||
tar xzf luajit2-${luajit2_ver}.tar.gz
|
||||
pushd luajit2-${luajit2_ver}
|
||||
make && make install
|
||||
popd > /dev/null
|
||||
rm -rf luajit2-${luajit2_ver}
|
||||
|
||||
src_url=http://mirrors.linuxeye.com/oneinstack/src/lua-resty-core-${lua_resty_core_ver}.tar.gz && Download_src
|
||||
tar xzf lua-resty-core-${lua_resty_core_ver}.tar.gz
|
||||
pushd lua-resty-core-${lua_resty_core_ver}
|
||||
make install
|
||||
popd > /dev/null
|
||||
rm -rf lua-resty-core-${lua_resty_core_ver}
|
||||
|
||||
src_url=http://mirrors.linuxeye.com/oneinstack/src/lua-resty-lrucache-${lua_resty_lrucache_ver}.tar.gz && Download_src
|
||||
tar xzf lua-resty-lrucache-${lua_resty_lrucache_ver}.tar.gz
|
||||
pushd lua-resty-lrucache-${lua_resty_lrucache_ver}
|
||||
make install
|
||||
popd > /dev/null
|
||||
rm -rf lua-resty-lrucache-${lua_resty_lrucache_ver}
|
||||
fi
|
||||
|
||||
tar xzf nginx-${NEW_nginx_ver}.tar.gz
|
||||
pushd nginx-${NEW_nginx_ver}
|
||||
make clean
|
||||
sed -i 's@CFLAGS="$CFLAGS -g"@#CFLAGS="$CFLAGS -g"@' auto/cc/gcc # close debug
|
||||
export LUAJIT_LIB=/usr/local/lib
|
||||
export LUAJIT_INC=/usr/local/include/luajit-2.1
|
||||
./configure ${nginx_configure_args}
|
||||
make -j ${THREAD}
|
||||
if [ -f "objs/nginx" ]; then
|
||||
/bin/mv ${nginx_install_dir}/sbin/nginx{,`date +%m%d`}
|
||||
/bin/cp objs/nginx ${nginx_install_dir}/sbin/nginx
|
||||
kill -USR2 `cat /var/run/nginx.pid`
|
||||
sleep 1
|
||||
kill -QUIT `cat /var/run/nginx.pid.oldbin`
|
||||
popd > /dev/null
|
||||
echo "You have ${CMSG}successfully${CEND} upgrade from ${CWARNING}${OLD_nginx_ver}${CEND} to ${CWARNING}${NEW_nginx_ver}${CEND}"
|
||||
rm -rf nginx-${NEW_nginx_ver}
|
||||
else
|
||||
echo "${CFAILURE}Upgrade Nginx failed! ${CEND}"
|
||||
fi
|
||||
fi
|
||||
popd > /dev/null
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user