github.com/canhui/fabric_ca2_2@v2.0.0-alpha+incompatible/images/fabric-ca-fvt/payload/system_update.sh (about)

     1  #!/bin/bash
     2  RC=0
     3  export DEBIAN_FRONTEND=noninteractive
     4  
     5  # Avoid sysvinit errors
     6  cat > /usr/sbin/policy-rc.d <<EOF
     7  #!/bin/bash
     8  exit 101
     9  EOF
    10  chmod +x /usr/sbin/policy-rc.d
    11  dpkg-divert --local --rename --add /sbin/initctl
    12  
    13  # Update system
    14  apt-get -y update && apt-get -y install --no-install-recommends locales
    15  sed -i -e 's/^[[:blank:]]*#[[:blank:]]*en_US.UTF-8[[:blank:]]*UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen
    16  printf "LANG=en_US.UTF-8\nLANGUAGE=en_US.UTF-8\n" > /etc/default/locale
    17  dpkg-reconfigure locales && update-locale LANG=en_US.UTF-8 || let RC+=1
    18  
    19  # Install more test depedencies
    20  echo "mysql-server mysql-server/root_password password mysql" | debconf-set-selections
    21  echo "mysql-server mysql-server/root_password_again password mysql" | debconf-set-selections
    22  apt-get -y install --no-install-recommends rsyslog bc vim lsof sqlite3 haproxy postgresql-$PGVER \
    23             postgresql-client-common postgresql-contrib-$PGVER isag jq git html2text \
    24             debconf-utils zsh htop python2.7-minimal libpython2.7-stdlib \
    25             mysql-client  mysql-common mysql-server parallel || let RC+=1
    26  apt-get -y install ssl-cert || let RC+=1
    27  apt-get -y autoremove
    28  
    29  # Configure rsyslog
    30  sed -i 's/^[[:blank:]]*#\([[:blank:]]*.*imudp.*\)/\1/' /etc/rsyslog.conf
    31  rm /etc/rsyslog.d/*haproxy*conf
    32  printf "local2.*    /var/log/haproxy.log\n& ~\n" > /etc/rsyslog.d/haproxy.conf
    33  printf "local0.*    /var/log/postgres.log\n& ~\n" > /etc/rsyslog.d/postgres.conf
    34  
    35  # Use python2, not 3
    36  ln -s /usr/bin/python2.7 /usr/local/bin/python && chmod 777 /usr/local/bin/python || let RC+=1
    37  
    38  # Clean up APT when done.
    39  apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
    40  
    41  exit $RC