VPS侦探论坛

 找回密码
 注册
查看: 6006|回复: 4

LNMP1.2 docker 容器镜像

[复制链接]
发表于 2016-2-10 19:27:11 | 显示全部楼层 |阅读模式

请教军哥,
我在想办法把lnmp1.2 做成lnmp docker 容器镜像,说的直接的一点,就是修改或添加一个新的main.sh脚本把默认项选好了自主安装就可以了。现在卡在了这段代码
  1. Press_Install()
  2. {
  3.     echo ""
  4.     echo "Press any key to install...or Press Ctrl+c to cancel"
  5.     OLDCONFIG=`stty -g`
  6.     stty -icanon -echo min 1 time 0
  7.     dd count=1 2>/dev/null
  8.     stty ${OLDCONFIG}
  9.     . include/version.sh
  10. }
复制代码


请问军哥这块怎么修改,让它不需要点击任何键直接运行啊?谢谢军哥,麻烦了!

这是修改过的main.sh, 主要是把read -p 注释掉:
  1. #!/bin/bash

  2. Dispaly_Selection()
  3. {
  4. #set mysql root password

  5.     MysqlRootPWD="LNMP123"
  6.     Echo_Yellow "Please setup root password of MySQL.(Default password: root)"
  7.     #read -p "Please enter: " MysqlRootPWD
  8.     if [ "${MysqlRootPWD}" = "" ]; then
  9.         MysqlRootPWD="LNMP123"
  10.     fi
  11.     echo "MySQL root password: ${MysqlRootPWD}"

  12. #do you want to enable or disable the InnoDB Storage Engine?
  13.     echo "==========================="

  14.     InstallInnodb="y"
  15.     Echo_Yellow "Do you want to enable or disable the InnoDB Storage Engine?"
  16.     #read -p "Default enable,Enter your choice [Y/n]: " InstallInnodb

  17.     case "${InstallInnodb}" in
  18.     [yY][eE][sS]|[yY])
  19.         echo "You will enable the InnoDB Storage Engine"
  20.     ;;
  21.     [nN][oO]|[nN])
  22.         echo "You will disable the InnoDB Storage Engine!"
  23.     ;;
  24.     *)
  25.         echo "No input,The InnoDB Storage Engine will enable."
  26.         InstallInnodb="y"
  27.     esac

  28. #which MySQL Version do you want to install?
  29.     echo "==========================="

  30.     DBSelect="2"
  31.     Echo_Yellow "You have 5 options for your DataBase install."
  32.     echo "1: Install MySQL 5.1.73"
  33.     echo "2: Install MySQL 5.5.42 (Default)"
  34.     echo "3: Install MySQL 5.6.23"
  35.     echo "4: Install MariaDB 5.5.42"
  36.     echo "5: Install MariaDB 10.0.17"
  37.     #read -p "Enter your choice (1, 2, 3, 4 or 5): " DBSelect

  38.     case "${DBSelect}" in
  39.     1)
  40.         echo "You will install MySQL 5.1.73"
  41.     ;;
  42.     2)
  43.         echo "You will install MySQL 5.5.42"
  44.     ;;
  45.     3)
  46.         echo "You will Install MySQL 5.6.23"
  47.     ;;
  48.     4)
  49.         echo "You will install MariaDB 5.5.42"
  50.     ;;
  51.     5)
  52.         echo "You will install MariaDB 10.0.17"
  53.     ;;
  54.     *)
  55.         echo "No input,You will install MySQL 5.5.42"
  56.         DBSelect="2"
  57.     esac

  58.     if [ "${DBSelect}" = "4" ] || [ "${DBSelect}" = "5" ]; then
  59.         MySQL_Bin="/usr/local/mariadb/bin/mysql"
  60.         MySQL_Config="/usr/local/mariadb/bin/mysql_config"
  61.         MySQL_Dir="/usr/local/mariadb"
  62.     else
  63.         MySQL_Bin="/usr/local/mysql/bin/mysql"
  64.         MySQL_Config="/usr/local/mysql/bin/mysql_config"
  65.         MySQL_Dir="/usr/local/mysql"
  66.     fi

  67. #which PHP Version do you want to install?
  68.     echo "==========================="

  69.     PHPSelect="5"
  70.     Echo_Yellow "You have 5 options for your PHP install."
  71.     echo "1: Install PHP 5.2.17"
  72.     echo "2: Install PHP 5.3.29"
  73.     echo "3: Install PHP 5.4.41 (Default)"
  74.     echo "4: Install PHP 5.5.25"
  75.     echo "5: Install PHP 5.6.9"
  76.     #read -p "Enter your choice (1, 2, 3, 4 or 5): " PHPSelect

  77.     case "${PHPSelect}" in
  78.     1)
  79.         echo "You will install PHP 5.2.17"
  80.     ;;
  81.     2)
  82.         echo "You will install PHP 5.3.29"
  83.     ;;
  84.     3)
  85.         echo "You will Install PHP 5.4.41"
  86.     ;;
  87.     4)
  88.         echo "You will install PHP 5.5.25"
  89.     ;;
  90.     5)
  91.         echo "You will install PHP 5.6.9"
  92.     ;;
  93.     *)
  94.         echo "No input,You will install PHP 5.4.41"
  95.         PHPSelect="3"
  96.     esac

  97. #which Memory Allocator do you want to install?
  98.     echo "==========================="

  99.     SelectMalloc="1"
  100.     Echo_Yellow "You have 3 options for your Memory Allocator install."
  101.     echo "1: Don't install Memory Allocator. (Default)"
  102.     echo "2: Install Jemalloc"
  103.     echo "3: Install TCMalloc"
  104.     #read -p "Enter your choice (1, 2 or 3): " SelectMalloc
复制代码
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
 楼主| 发表于 2016-2-10 23:34:06 | 显示全部楼层


大家,有没有办法模拟输入回车或任意键啊
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
发表于 2016-2-11 15:41:23 | 显示全部楼层

read的都去掉
需要确认的去掉
选择菜单去掉,只留变量赋值那些,自己直接指定上变量的值的就行了
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
 楼主| 发表于 2016-2-12 13:24:53 | 显示全部楼层



谢谢!搞定了!!!!
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
发表于 2016-11-27 01:18:44 | 显示全部楼层

终于在这里找你两位大大了,已经用上楼主的镜像,真是太棒了。

军哥运维代购:http://shop63846532.taobao.com/

您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|VPS侦探 ( 鲁ICP备16040043号-1 )

GMT+8, 2024-11-16 16:22 , Processed in 0.026202 second(s), 16 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表