#!/bin/sh PROGRAM=setup-acf VERSION=@VERSION@ PREFIX= . $PREFIX/lib/libalpine.sh usage() { echo "$PROGRAM [-ahn] [-e email] [-l address] [PACKAGE...]" exit 0; } pkgs="acf-core acf-alpine-baselayout acf-apk-tools openssl" while getopts "ae:hl:n" opt ; do case $opt in a) pkgs=$(apk search --quiet --exact 'acf-*');; e) EMAIL="$OPTARG";; h) usage;; l) address="$OPTARG";; n) create_passwd=no;; *) usage;; esac done shift $(expr $OPTIND - 1) while [ $# -gt 0 ]; do pkgs="$pkgs acf-$1" shift done # install packages apk add mini_httpd $pkgs || exit 1 if [ "$create_passwd" != "no" ]; then mkdir -p /etc/acf if [ -f /etc/acf/passwd ]; then mv /etc/acf/passwd /etc/acf/passwd.backup fi echo "root:x:Admin account:ADMIN" >/etc/acf/passwd chmod 600 /etc/acf/passwd acfpasswd -s root fi # setup mini_httpd and start it if [ -d /var/www/localhost/htdocs ]; then mv /var/www/localhost/htdocs /var/www/localhost/htdocs.old fi mkdir -p /var/www/localhost/ ln -s /usr/share/acf/www/ /var/www/localhost/htdocs lbu add /var/www/localhost/htdocs SSLDIR=/etc/ssl/mini_httpd SSLCNF=$SSLDIR/mini_httpd.cnf KEYFILE=$SSLDIR/server.key CRTFILE=$SSLDIR/server.crt PEMFILE=$SSLDIR/server.pem if [ -f $PEMFILE ]; then echo "$PEMFILE already exist." else mkdir -p $SSLDIR cat >$SSLCNF < $KEYFILE openssl req -new -x509 -nodes -sha1 -days 3650 -key $KEYFILE \ -config $SSLCNF > $CRTFILE cat $KEYFILE >> $CRTFILE rm $KEYFILE mv $CRTFILE $PEMFILE fi cat >/etc/mini_httpd/mini_httpd.conf <> /etc/mini_httpd/mini_httpd.conf fi rc-update -q add mini_httpd default /etc/init.d/mini_httpd restart # force update of dependency cache rc-update -q --update