maxwhale 发表于 2016-2-10 19:27:11

LNMP1.2 docker 容器镜像

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

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

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

Dispaly_Selection()
{
#set mysql root password

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

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

    InstallInnodb="y"
    Echo_Yellow "Do you want to enable or disable the InnoDB Storage Engine?"
    #read -p "Default enable,Enter your choice : " InstallInnodb

    case "${InstallInnodb}" in
    |)
      echo "You will enable the InnoDB Storage Engine"
    ;;
    |)
      echo "You will disable the InnoDB Storage Engine!"
    ;;
    *)
      echo "No input,The InnoDB Storage Engine will enable."
      InstallInnodb="y"
    esac

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

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

    case "${DBSelect}" in
    1)
      echo "You will install MySQL 5.1.73"
    ;;
    2)
      echo "You will install MySQL 5.5.42"
    ;;
    3)
      echo "You will Install MySQL 5.6.23"
    ;;
    4)
      echo "You will install MariaDB 5.5.42"
    ;;
    5)
      echo "You will install MariaDB 10.0.17"
    ;;
    *)
      echo "No input,You will install MySQL 5.5.42"
      DBSelect="2"
    esac

    if [ "${DBSelect}" = "4" ] || [ "${DBSelect}" = "5" ]; then
      MySQL_Bin="/usr/local/mariadb/bin/mysql"
      MySQL_Config="/usr/local/mariadb/bin/mysql_config"
      MySQL_Dir="/usr/local/mariadb"
    else
      MySQL_Bin="/usr/local/mysql/bin/mysql"
      MySQL_Config="/usr/local/mysql/bin/mysql_config"
      MySQL_Dir="/usr/local/mysql"
    fi

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

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

    case "${PHPSelect}" in
    1)
      echo "You will install PHP 5.2.17"
    ;;
    2)
      echo "You will install PHP 5.3.29"
    ;;
    3)
      echo "You will Install PHP 5.4.41"
    ;;
    4)
      echo "You will install PHP 5.5.25"
    ;;
    5)
      echo "You will install PHP 5.6.9"
    ;;
    *)
      echo "No input,You will install PHP 5.4.41"
      PHPSelect="3"
    esac

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

    SelectMalloc="1"
    Echo_Yellow "You have 3 options for your Memory Allocator install."
    echo "1: Don't install Memory Allocator. (Default)"
    echo "2: Install Jemalloc"
    echo "3: Install TCMalloc"
    #read -p "Enter your choice (1, 2 or 3): " SelectMalloc

maxwhale 发表于 2016-2-10 23:34:06

大家,有没有办法模拟输入回车或任意键啊

licess 发表于 2016-2-11 15:41:23

read的都去掉
需要确认的去掉
选择菜单去掉,只留变量赋值那些,自己直接指定上变量的值的就行了

maxwhale 发表于 2016-2-12 13:24:53

谢谢!搞定了!!!!

withero 发表于 2016-11-27 01:18:44

终于在这里找你两位大大了,已经用上楼主的镜像,真是太棒了。
页: [1]
查看完整版本: LNMP1.2 docker 容器镜像