aboutsummaryrefslogtreecommitdiff
path: root/useradd.sh
blob: 252c09272d75eb68d4294f6b6185ca57b5767149 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/bin/bash

if [[ $1 == "" || $2 == "" ]];then
    read -p"username: " username 
    read -p"password: " password 
    read -p"retap password: " password2
    while [[ $password != $password2 || $password == "" ]]
    do
        echo "mismatch passord"
        read -p"password: " password
        read -p"retap password: " password2
    done
else
    username=$1
    password=$2
fi

if [[ $username != "root" ]]; then
    mkdir -p "build/airootfs/home/$username"
fi
echo $username":"$(mkpasswd  -m sha-512 -S spaceunicorne -s <<< $password)":17076:0:99999:7:::" >> build/airootfs/etc/shadow