diff options
author | Daniel Hansson <daniel@techandme.se> | 2017-10-08 13:58:46 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-08 13:58:46 +0300 |
commit | 4c03045ad7c0cbb8d96bd03292e54383a9016b2d (patch) | |
tree | 43d53c28e4091581147ea9356681a83b827fc873 /static/adduser.sh | |
parent | bac9bfedbc05a1ebc04e75a94bc17cf850ed27e4 (diff) |
move ncadmin check to adduser instead (#398)
Diffstat (limited to 'static/adduser.sh')
-rw-r--r-- | static/adduser.sh | 35 |
1 files changed, 24 insertions, 11 deletions
diff --git a/static/adduser.sh b/static/adduser.sh index 64eb9ad2..43569e7b 100644 --- a/static/adduser.sh +++ b/static/adduser.sh @@ -12,16 +12,29 @@ true DEBUG=0 debug_mode -if [[ "no" == $(ask_yes_or_no "Do you want to create a new user?") ]] +if [[ $UNIXUSER != "ncadmin" ]] then - echo "Not adding another user..." - sleep 1 -else - read -r -p "Enter name of the new user: " NEWUSER - useradd -m "$NEWUSER" -G sudo - while true - do - sudo passwd "$NEWUSER" && break - done - sudo -u "$NEWUSER" sudo bash nextcloud_install_production.sh + echo + echo "Current user with sudo permissions is: $UNIXUSER". + echo "This script will set up everything with that user." + echo "If the field after ':' is blank you are probably running as a pure root user." + echo "It's possible to install with root, but there will be minor errors." + echo + echo "Please create a user with sudo permissions if you want an optimal installation." + echo "The preferred user is 'ncadmin'." + if [[ "no" == $(ask_yes_or_no "Do you want to create a new user?") ]] + then + echo "Not adding another user..." + sleep 1 + else + read -r -p "Enter name of the new user: " NEWUSER + adduser --disabled-password --gecos "" "$NEWUSER" + sudo usermod -aG sudo "$NEWUSER" + usermod -s /bin/bash "$NEWUSER" + while true + do + sudo passwd "$NEWUSER" && break + done + sudo -u "$NEWUSER" sudo bash nextcloud_install_production.sh + fi fi |