Better error resistance (don't fail if user already exists)
This commit is contained in:
parent
d2836b92eb
commit
72886e5676
18
install.lua
18
install.lua
@ -75,10 +75,24 @@ if baad then
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if not os.execute"adduser --shell /bin/sh --disabled-password ikibooru" then
|
if select(3, os.execute"id ikibooru") == 0 then
|
||||||
|
while true do
|
||||||
|
io.stdout:write"User ikibooru already exists. Can use? (y/n): "
|
||||||
|
local o = io.read"*l":lower()
|
||||||
|
if o == "y" then
|
||||||
|
break
|
||||||
|
elseif o == "n" then
|
||||||
|
print"Exiting."
|
||||||
|
return
|
||||||
|
end
|
||||||
|
print"Try again."
|
||||||
|
end
|
||||||
|
else
|
||||||
|
if not os.execute"useradd -U -m -s /bin/sh ikibooru" then
|
||||||
print"Failed to create user ikibooru."
|
print"Failed to create user ikibooru."
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
io.stdout:write"MySQL host: "
|
io.stdout:write"MySQL host: "
|
||||||
local mysqladdr = io.read"*l"
|
local mysqladdr = io.read"*l"
|
||||||
@ -301,4 +315,4 @@ end
|
|||||||
|
|
||||||
print""
|
print""
|
||||||
|
|
||||||
print"Installation complete. Remember: Ikibooru is only an HTTP server. It must be used together with a relay or reverse proxy."
|
print"Installation complete. Reminder: Ikibooru is only an HTTP server. It must be used together with a relay or reverse proxy."
|
||||||
|
Loading…
Reference in New Issue
Block a user