write_tftpd_config() { install_files "tftpd" echo "# Removing any tftpd config from (x)inetd... " # sometimes a tftp stating line remains in /etc/inetd.conf if [ -f /etc/inetd.conf ]; then if grep -q "^tftp.*dgram.*udp4" /etc/inetd.conf; then echo "Deleting /etc/inetd.conf entry for tftpd" sed -i '/^tftp.*dgram.*udp4/d' /etc/inetd.conf fi fi for i in /etc/xinetd.d/*; do [ -f "$i" ] || continue grep -q 'service.*tftp' "$i" || continue echo "Deleting $i" rm -f -- "$i" done } patch_lighttpd_config() { local mod file echo "# Customizing lighttpd config" for mod in fastcgi fastcgi-php; do file=$(echo /etc/lighttpd/conf-available/??-${mod}.conf) # expand ?? [ -f "$file" ] || perror "Could not find path for $mod" file=$(basename "$file") ln -sf "../conf-available/$file" "/etc/lighttpd/conf-enabled/$file" || perror "Could not enable module $mod" done mkdir -p "$WWWDIR" || perror "Could not create www-dir ($WWWDIR)" install_files "lighttpd" } patch_php_config() { local PHPINIFILE echo "# Patching php configuration... " # TODO Throw snippet into conf.d/ instead for PHPINIFILE in /etc/php*/cgi/php.ini /etc/php/*/cgi/php.ini; do [ -f "$PHPINIFILE" ] || continue if grep -q -E "^\s*upload_max_filesize" "$PHPINIFILE"; then sed -i -e '/^\s*upload_max_filesize/c\upload_max_filesize = 100M' "$PHPINIFILE" || pwarning "Could not increase PHP upload limit" else echo "upload_max_filesize = 100M" >> "$PHPINIFILE" || pwarning "Could not increase PHP upload limit" fi if grep -q -E '^\s*post_max_size' "$PHPINIFILE"; then sed -i -e '/^\s*post_max_size/c\post_max_size = 100M' "$PHPINIFILE" || pwarning "Could not increase PHP POST limit" else echo "post_max_size = 100M" >> "$PHPINIFILE" || pwarning "Could not increase PHP POST limit" fi done } config_nfs() { echo "# Patching /etc/exports for NFS and creating directories... " if grep -q "/srv/openslx/nfs" /etc/exports; then echo "NFS entry already there; doing nothing." else echo '/srv/openslx/nfs *(ro,async,insecure,no_root_squash,no_subtree_check)' >> /etc/exports fi mkdir -p /srv/openslx/nfs 2>/dev/null chown dmsd:images /srv/openslx/nfs || perror "Setting owner of /srv/openslx/nfs failed" chmod 775 /srv/openslx/nfs }