From 2741f5afe0168b8f72654c8b3cab095665174c52 Mon Sep 17 00:00:00 2001 From: Natanael Copa Date: Wed, 19 Aug 2009 14:20:03 +0000 Subject: setup-webconf: create admin user by default --- setup-webconf.in | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/setup-webconf.in b/setup-webconf.in index f950db1..3769a12 100644 --- a/setup-webconf.in +++ b/setup-webconf.in @@ -7,17 +7,18 @@ PREFIX= . $PREFIX/lib/libalpine.sh usage() { - echo "$PROGRAM [-ah] [-l address] [PACKAGE...]" + echo "$PROGRAM [-ahn] [-l address] [PACKAGE...]" exit 0; } pkgs="acf-core acf-alpine-baselayout acf-apk-tools" -while getopts "ahl:" opt ; do +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 @@ -28,6 +29,17 @@ while [ $# -gt 0 ]; do 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 -- cgit v1.2.3