Browse Source

feat: Add md5sum

oneinstack 1 year ago
parent
commit
d777754107
2 changed files with 39 additions and 6 deletions
  1. 34 1
      install.sh
  2. 5 5
      versions.txt

+ 34 - 1
install.sh

@@ -68,11 +68,12 @@ Show_Help() {
   --phpmyadmin                Install phpMyAdmin
   --ssh_port [No.]            SSH port
   --firewall                  Enable firewall
+  --md5sum                    Check md5sum
   --reboot                    Restart the server after installation
   "
 }
 ARG_NUM=$#
-TEMP=`getopt -o hvV --long help,version,nginx_option:,apache,apache_mode_option:,apache_mpm_option:,php_option:,mphp_ver:,mphp_addons,phpcache_option:,php_extensions:,nodejs,tomcat_option:,jdk_option:,db_option:,dbrootpwd:,dbinstallmethod:,pureftpd,redis,memcached,phpmyadmin,ssh_port:,firewall,reboot -- "$@" 2>/dev/null`
+TEMP=`getopt -o hvV --long help,version,nginx_option:,apache,apache_mode_option:,apache_mpm_option:,php_option:,mphp_ver:,mphp_addons,phpcache_option:,php_extensions:,nodejs,tomcat_option:,jdk_option:,db_option:,dbrootpwd:,dbinstallmethod:,pureftpd,redis,memcached,phpmyadmin,ssh_port:,firewall,md5sum,reboot -- "$@" 2>/dev/null`
 [ $? != 0 ] && echo "${CWARNING}ERROR: unknown argument! ${CEND}" && Show_Help && exit 1
 eval set -- "${TEMP}"
 while :; do
@@ -196,6 +197,9 @@ while :; do
     --firewall)
       firewall_flag=y; shift 1
       ;;
+    --md5sum)
+      md5sum_flag=y; shift 1
+      ;;
     --reboot)
       reboot_flag=y; shift 1
       ;;
@@ -208,6 +212,35 @@ while :; do
   esac
 done
 
+# Check md5sum
+if [ ${ARG_NUM} == 0 ]; then
+  # Check md5sum
+  while :; do echo
+    read -e -p "Do you want to check md5sum? [y/n]: " md5sum_flag
+    if [[ ! ${firewall_flag} =~ ^[y,n]$ ]]; then
+      echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}"
+    else
+      break
+    fi
+  done
+fi
+if [ "${md5sum_flag}" == 'y' ]; then
+  [ -e "${oneinstack_dir}.tar.gz" ] && oneinstack_file=${oneinstack_dir}.tar.gz
+  [ -e "${oneinstack_dir}-full.tar.gz" ] && oneinstack_file=${oneinstack_dir}-full.tar.gz
+  oneinstack_tgz=${oneinstack_file##*/}
+  if [ -e "${oneinstack_file}" ]; then
+    now_oneinstack_md5=$(md5sum ${oneinstack_file} | awk '{print $1}')
+    latest_oneinStack_md5=$(curl --connect-timeout 3 -m 5 -s ${mirror_link}/md5sum.txt | grep ${oneinstack_tgz} | awk '{print $1}')
+    if [ "${now_oneinstack_md5}" != "${latest_oneinStack_md5}" ]; then
+      echo "${CFAILURE}Error: The md5 value of the installation package does not match the official website, please download again, url: ${mirror_link}/${oneinstack_tgz}${CEND}"
+      exit 1
+    fi
+  else
+    echo "${CFAILURE}Error: ${oneinstack_file} does not exist${CEND}"
+    exit 1
+  fi
+fi
+
 # Use default SSH port 22. If you use another SSH port on your server
 if [ -e "/etc/ssh/sshd_config" ]; then
   [ -z "`grep ^Port /etc/ssh/sshd_config`" ] && now_ssh_port=22 || now_ssh_port=`grep ^Port /etc/ssh/sshd_config | awk '{print $2}' | head -1`

+ 5 - 5
versions.txt

@@ -48,14 +48,14 @@ php72_ver=7.2.34
 php73_ver=7.3.33
 php74_ver=7.4.33
 php80_ver=8.0.30
-php81_ver=8.1.23
-php82_ver=8.2.10
+php81_ver=8.1.24
+php82_ver=8.2.11
 
 # Nodejs
-nodejs_ver=18.17.1
+nodejs_ver=18.18.0
 
 libiconv_ver=1.16
-curl_ver=8.2.1
+curl_ver=8.3.0
 libmcrypt_ver=2.5.8
 mcrypt_ver=2.6.8
 mhash_ver=0.9.9.9
@@ -64,7 +64,7 @@ icu4c_ver=63_1
 libsodium_ver=1.0.18
 libzip_ver=1.2.0
 argon2_ver=20171227
-imagemagick_ver=7.1.1-16
+imagemagick_ver=7.1.1-19
 imagick_ver=3.7.0
 imagick_oldver=3.4.4
 graphicsmagick_ver=1.3.40