actived_opt.sh

  1. #!/bin/sh
  2. ### need some variables
  3. . /opt/etc/system.var
  4. decodeversion="1.2.4"
  5. optversion="`cat /opt/OPT_VERSION`"
  6.  
  7.  
  8. echo " --> starting the integration script ${optversion}"
  9. ### only for root
  10. if [ "${USER}" = "root" ] || [ "${1}" = "--force" ]; then
  11.   echo -n " --> actived make.conf "
  12.   if [ ! -e /etc/make.conf ]; then
  13.     ln -s /opt/etc/make.conf-system /etc/make.conf
  14.     echo -e "${ISINSTALLED}"
  15.   else
  16.     echo -e "${NOTHINGTODO}"
  17.   fi
  18.   echo -n " --> installing firewall, without turn it on! "
  19.   FIREWALL="YES"
  20.   grep "firewall" /etc/rc.conf >/dev/null 2>&1 || FIREWALL="NO"
  21.   if [ "${FIREWALL}" = "NO" ]; then
  22.     echo '' >>/etc/rc.conf
  23.     echo '###### Firewall ######'>>/etc/rc.conf
  24.     echo 'firewall_enable="NO"' >>/etc/rc.conf
  25.     echo 'firewall_script="/opt/bin/firewall"' >>/etc/rc.conf
  26.     echo 'natd_enable="NO"' >>/etc/rc.conf
  27.     echo 'natd_program="NO"' >>/etc/rc.conf
  28.     echo 'natd_interface="re0"' >>/etc/rc.conf
  29.     echo 'gateway_enable="NO"' >>/etc/rc.conf
  30.     echo '## We need pf for jail-internet connections' >>/etc/rc.conf
  31.     echo 'pf_enable="NO"' >>/etc/rc.conf
  32.     echo 'pf_rules="/opt/etc/pf.conf"' >>/etc/rc.conf
  33.     echo -e "${ISINSTALLED}"
  34.   else
  35.     echo -e "${NOTHINGTODO}"
  36.   fi
  37.   echo -n " --> installing JAIL support in rc.conf! "
  38.   JAIL="YES"
  39.   grep "jail_enable" /etc/rc.conf >/dev/null 2>&1 || JAIL="NO"
  40.   if [ "${JAIL}" = "NO" ]; then
  41.     echo '' >>/etc/rc.conf
  42.     echo '###### JAILS ######' >>/etc/rc.conf
  43.     echo 'jail_enable="NO"' >>/etc/rc.conf
  44.     echo 'jail_list=""' >>/etc/rc.conf
  45.     echo -e "${ISINSTALLED}"
  46.   else
  47.     echo -e "${NOTHINGTODO}"
  48.   fi
  49.  
  50.   echo -n " --> installing JAIL configuration (jail.conf)! "
  51.   if [ -h /etc/jail.conf ]; then
  52.     echo -e "${NOTHINGTODO}"
  53.   else
  54.     ln -s /opt/etc/jail.conf /etc/jail.conf
  55.     echo -e "${ISINSTALLED}"
  56.   fi  
  57.  
  58.   echo -n " --> installing decode-cgi V${decodeversion} for www shell scripts! "
  59.   if [ -e /opt/bin/decode-cgi ]; then
  60.     DECODE="NO"
  61.     echo
  62.     echo -n "   ^--> find decode-cgi in /opt/bin <-- so i do nothing! "
  63.   else
  64.     DECODE="YES"
  65.     cd /opt/src/decode-cgi-${decodeversion} || DECODE="NO"
  66.     /usr/bin/make >/dev/null 2>&1 || DECODE="NO"
  67.     mv /opt/src/decode-cgi-${decodeversion}/decode-cgi /opt/bin || DECODE="NO"
  68.     /usr/bin/make clean >/dev/null 2>&1 || DECODE="NO"
  69.   fi
  70.   if [ "${DECODE}" = "YES" ]; then
  71.     echo -e "${ISINSTALLED}"
  72.   else
  73.     echo -e "${NOTHINGTODO}"
  74.   fi
  75.  
  76.   echo -n " --> create symlink /usr/home -> /home"
  77.   if [ -h /home ]; then
  78.     echo -e "${NOTHINGTODO}"
  79.   else
  80.     ln -s /usr/home /home
  81.     echo -e "${ISINSTALLED}"
  82.   fi
  83.  
  84.   echo -n " --> create symlink interfaces.sh -> /usr/local/etc/rc.d/..."
  85.   if [ -h /usr/local/etc/rc.d/999interfaces.sh ]; then
  86.     echo -e "${NOTHINGTODO}"
  87.   else
  88.     if [ ! -d "/usr/local/etc/rc.d" ]; then
  89.       mkdir "/usr/local/etc/rc.d"
  90.     fi
  91.     ln -s /opt/bin/interfaces.sh /usr/local/etc/rc.d/999interfaces.sh
  92.     echo -e "${ISINSTALLED}"
  93.   fi
  94.  
  95.   echo -n " --> create symlink mergemaster.rc -> /etc"
  96.   if [ -h /etc/mergemaster.rc ]; then
  97.     echo -e "${NOTHINGTODO}"
  98.   else
  99.     ln -s /opt/etc/mergemaster.rc /etc/mergemaster.rc
  100.     echo -e "${ISINSTALLED}"
  101.   fi
  102.  
  103.   echo -n " --> create symlink mjail -> /bin"
  104.   if [ -h /bin/mjail ]; then
  105.     echo -e "${NOTHINGTODO}"
  106.   else
  107.     ln -s /opt/bin/mjail.sh /bin/mjail
  108.     echo -e "${ISINSTALLED}"
  109.   fi
  110.  
  111.   echo -n " --> create symlink adduser.conf -> /etc"
  112.   if [ -h /etc/adduser.conf ]; then
  113.     echo -e "${NOTHINGTODO}"
  114.   else
  115.     ln -s /opt/etc/adduser.conf /etc/adduser.conf
  116.     echo -e "${ISINSTALLED}"
  117.   fi
  118.  
  119.   echo -n " --> create symlink consolefax.sh -> /bin"
  120.   if [ -h /bin/consolefax ]; then
  121.     echo -e "${NOTHINGTODO}"
  122.   else
  123.     ln -s /opt/bin/consolefax.sh /bin/consolefax
  124.     echo -e "${ISINSTALLED}"
  125.   fi
  126.  
  127.   echo -n " --> actived german language support"
  128.   checklogin="`/usr/bin/cmp /opt/etc/login.conf /etc/login.conf`"
  129.  
  130.   if [ -z "${checklogin}" ]; then
  131.     echo -e "${NOTHINGTODO}"
  132.   else
  133.     cp /opt/etc/login.conf /etc/login.conf
  134.     /usr/bin/cap_mkdb /etc/login.conf
  135.     echo -e "${ISINSTALLED}"
  136.   fi
  137.  
  138.   echo -n " --> installing PKG configuration (FreeBSD.conf)! "
  139.   if [ -e /usr/local/etc/pkg/repos/FreeBSD.conf ]; then
  140.     echo -e "${NOTHINGTODO}"
  141.   else
  142.     mkdir -p /usr/local/etc/pkg/repos >/dev/null 2>&1
  143.     ln -s /opt/etc/FreeBSD.conf /usr/local/etc/pkg/repos/FreeBSD.conf
  144.     echo -e "${ISINSTALLED}"
  145.   fi  
  146.  
  147.  ### END for user root
  148. fi
  149.  
  150. ### for all users
  151. echo -n " --> make some changes in ~/.profile"
  152. INSTALLED="YES"
  153. grep "system.var" ~/.profile >/dev/null 2>&1 || INSTALLED="NO"
  154. if [ "${INSTALLED}" = "NO" ]; then
  155.   sed -e 's/cons25}/cons25l1}/g' \
  156.     -e 's/more/less/g' \
  157.     <~/.profile >~/.profile.new \
  158.     && echo '[ -n "${BASH}" ] && source /opt/etc/system.var && /opt/bin/interfaces.sh start' \
  159.     >>~/.profile.new && mv ~/.profile.new ~/.profile \
  160.     && INSTALLED="YES"
  161.   if [ "${INSTALLED}" = "YES" ]; then
  162.     echo -e "${ISINSTALLED}"
  163.   else
  164.     echo -e "${NOTHINGTODO}"
  165.   fi
  166. else
  167.   echo -e "${NOTHINGTODO}"
  168. fi
  169.  
  170. if [ "${1}" = "--force" ]; then
  171.   sed -e 's/cons25}/cons25l1}/g' \
  172.     -e 's/more/less/g' \
  173.     </root/.profile >/root/.profile.new \
  174.     && echo '[ -n "${BASH}" ] && source /opt/etc/system.var && /opt/bin/interfaces.sh start' \
  175.     >>/root/.profile.new && mv /root/.profile.new /root/.profile \
  176.     && INSTALLED="YES"
  177.   if [ "${INSTALLED}" = "YES" ]; then
  178.     echo -e "${ISINSTALLED}"
  179.   else
  180.     echo -e "${NOTHINGTODO}"
  181.   fi
  182. fi
  183.  
  184. exit 0
  185.  
  186. </code