Commit 3512ee0a authored by Jondy Zhao's avatar Jondy Zhao

Show error and exit when run post-install script

parent f52dbd09
......@@ -14,11 +14,18 @@
#
# * Change readme.txt to dos format
#
function show_error_exit()
{
echo Error: $1
read -n 1 -p "Press any key to exit..."
exit 1
}
password_filename=/etc/passwd
echo Checking passwd file ...
if [[ ! -f $password_filename ]] ; then
echo No passwd file found.
mkpasswd > $password_filename
mkpasswd -l > $password_filename || show_error_exit "mkpasswd failed"
echo Generate passwd file OK.
else
echo Check passwd file OK.
......@@ -27,7 +34,7 @@ fi
echo Checking group file ...
if [[ ! -f /etc/group ]] ; then
echo No group file found.
mkgroup > /etc/group
mkgroup -l > /etc/group || show_error_exit "mkgroup failed"
echo Generate group file OK.
else
echo Check group file OK.
......@@ -105,4 +112,3 @@ cp /etc/slapos/scripts/slap-runner.html{,.orig}
echo Run post-install script successfully.
read -n 1 -t 60 -p "Press any key to exit..."
exit 0
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment