From 00f15e21d67fa22ea631f2aa0727ab2f08bf14dd Mon Sep 17 00:00:00 2001 From: Natanael Copa Date: Wed, 19 Aug 2009 14:28:48 +0000 Subject: renamed setup-webconf to setup-acf --- Makefile | 2 +- setup-acf.in | 111 ++++++++++++++++++++++++++++++++++++++++++++++++++++ setup-alpine-web.in | 2 +- setup-webconf.in | 111 ---------------------------------------------------- 4 files changed, 113 insertions(+), 113 deletions(-) create mode 100644 setup-acf.in delete mode 100644 setup-webconf.in diff --git a/Makefile b/Makefile index 3ec5557..d2a5dfc 100644 --- a/Makefile +++ b/Makefile @@ -22,7 +22,7 @@ SBIN_FILES := albootstrap\ setup-keymap\ setup-mta\ setup-sendbug\ - setup-webconf\ + setup-acf\ update-conf SCRIPTS := $(LIB_FILES) $(SBIN_FILES) diff --git a/setup-acf.in b/setup-acf.in new file mode 100644 index 0000000..3769a12 --- /dev/null +++ b/setup-acf.in @@ -0,0 +1,111 @@ +#!/bin/sh + +PROGRAM=setup-acf +VERSION=@VERSION@ + +PREFIX= +. $PREFIX/lib/libalpine.sh + +usage() { + echo "$PROGRAM [-ahn] [-l address] [PACKAGE...]" + exit 0; +} + +pkgs="acf-core acf-alpine-baselayout acf-apk-tools" + +while getopts "ahl:n" opt ; do + case $opt in + a) pkgs=`apk_fetch -l | grep ^acf-`;; + 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 + +if [ "$create_passwd" != "no" ]; then + askpassword "root ACF" + if [ -f /etc/acf/passwd ]; then + mv /etc/acf/passwd /etc/acf/passwd.backup + fi + # this will show password on process list but we assume user is alone + # on the box at this stage + _md5passwd=$(echo -n "$_password" | md5sum) + echo "root:$_md5passwd:Admin account:ADMIN" >/etc/acf/passwd +fi + +# install packages +apk_add mini_httpd $pkgs || exit 1 + +# 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.conf <> /etc/mini_httpd.conf +fi + +cat >/etc/conf.d/mini_httpd </etc/acf/passwd -fi - -# install packages -apk_add mini_httpd $pkgs || exit 1 - -# 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.conf <> /etc/mini_httpd.conf -fi - -cat >/etc/conf.d/mini_httpd <