Impove installer

This commit is contained in:
mid 2024-06-11 16:53:52 +03:00
parent 59a5f48780
commit 5147307d65

View File

@ -71,7 +71,14 @@ else
baad = true
end
os.execute"adduser --shell /bin/sh --disabled-password ikibooru"
if baad then
return
end
if not os.execute"adduser --shell /bin/sh --disabled-password ikibooru" then
print"Failed to create user ikibooru."
return
end
io.stdout:write"MySQL host: "
local mysqladdr = io.read"*l"
@ -161,11 +168,11 @@ os.execute"rm /home/ikibooru/ikibooru/install.lua"
-- Not /dev/urandom. System might be new and unseeded.
os.execute"dd if=/dev/random of=/home/ikibooru/ikibooru/objkey bs=16 count=1"
os.execute"chown -R ikibooru:ikibooru /home/ikibooru/*"
os.execute"find /home/ikibooru/ -type f -exec chmod 444 {} \;"
os.execute"find /home/ikibooru/ -type d -exec chmod 555 {} \;"
os.execute"find /home/ikibooru/ -type f -exec chmod 444 {} \\;"
os.execute"find /home/ikibooru/ -type d -exec chmod 555 {} \\;"
os.execute"chmod 440 /home/ikibooru/ikibooru/objkey"
-- # These files need writability
os.execute"find /home/ikibooru/ikibooru/objd/ -type d -exec chmod 755 {} \;"
-- These files need writability
os.execute"find /home/ikibooru/ikibooru/objd/ -type d -exec chmod 755 {} \\;"
os.execute"chmod 644 /home/ikibooru/ikibooru/static/tagcats.css"
local cfg = io.open("/home/ikibooru/ikibooru/cfg.lua", "wb")
@ -175,7 +182,7 @@ cfg:close() cfg = nil
os.execute"chmod 640 /home/ikibooru/ikibooru/cfg.lua"
os.execute"chown -R root:root /home/ikibooru/ikibooru/uninstall.lua"
os.execute"chown root:root /home/ikibooru/ikibooru/uninstall.lua"
SQLConn:execute[[CREATE DATABASE ikibooru CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;]]
SQLConn:execute[[USE ikibooru;]]
@ -294,4 +301,4 @@ end
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. Remember: Ikibooru is only an HTTP server. It must be used together with a relay or reverse proxy."