summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2009-08-19 14:20:03 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2009-08-19 14:28:02 +0000
commit2741f5afe0168b8f72654c8b3cab095665174c52 (patch)
treeda9419d26162138828684d36e4c11cc47b5ea2e3
parent7ba8c4c2c09fc6df6c0c34e0d953ef3bc21224a0 (diff)
downloadalpine-conf-2741f5afe0168b8f72654c8b3cab095665174c52.zip
setup-webconf: create admin user by default
-rw-r--r--setup-webconf.in16
1 files 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