#!/bin/sh PREREQ="" DESCRIPTION="Removing unnecessary services ..." prereqs() { echo "$PREREQ" } case $1 in # get pre-requisites prereqs) prereqs exit 0 ;; esac . /scripts/casper-functions read_dir(){ local F D D="$1" if [ -d "${D}" ] ; then for F in $(ls ${D}) ; do if [ -f "${D}/${F}" ] ; then cat "${D}/${F}" |tr "\n" " " fi done echo " " fi } case $1 in # get pre-requisites prereqs) prereqs exit 0 ;; esac log_begin_msg "$DESCRIPTION" # read the conf file LLIUREX_SRV_DIR="/root/etc/lliurex-live-scripts/services" DENY_DIR="${LLIUREX_SRV_DIR}/deny" ALLOW_DIR="${LLIUREX_SRV_DIR}/allow" DENY_LIST="$(read_dir "$DENY_DIR")" ALLOW_LIST="$(read_dir "$ALLOW_DIR")" for s in $DENY_LIST ; do if [ -x /root/etc/init.d/${s} ] ; then if ! echo " $ALLOW_LIST " |grep -q " ${s} " ; then chroot /root update-rc.d -f ${s} remove >/dev/null 2>/dev/null || true fi fi done LLIUREX_SRV_DIR="/root/etc/lliurex-live-scripts/policy" DENY_DIR="${LLIUREX_SRV_DIR}/disable" ALLOW_DIR="${LLIUREX_SRV_DIR}/enable" DENY_LIST="$(read_dir "$DENY_DIR")" ALLOW_LIST="$(read_dir "$ALLOW_DIR")" for s in $DENY_LIST ; do if [ -x /root/etc/init.d/${s} ] ; then if ! echo " $ALLOW_LIST " |grep -q " ${s} " ; then chroot /root llxcfg-policy disable ${s} >/dev/null 2>/dev/null || true fi fi done # special services # squid for p in squid squid3 ; do [ ! -d /root/etc/$p/ ] || echo "maximum_object_size 0 KB" >> /root/etc/$p/local-squid.conf done # apache [ ! -d /root/etc/apache2/conf.d/ ] || echo "EnableSendfile off" > /root/etc/apache2/conf.d/unionfs-hack.conf log_end_msg