function watcher()
    local event = os.pullEventRaw("terminate")
    os.shutdown()
end

function DrawBackground(w,h)
    term.clear();
    paintutils.drawFilledBox(1,1,w,h,colors.white);
    paintutils.drawFilledBox(1,1,w,1,colors.blue);
    term.setBackgroundColor(colors.blue);
    term.setTextColor(colors.orange);
    local info = "CAINIAOTECH"
    term.setCursorPos(w/2-string.len(info)/2,1);
    term.write(info);
    term.setBackgroundColor(colors.white);
    term.setTextColor(colors.black);
end

function Panel()
    local w,h = term.getSize()
    while true do
        DrawBackground(w,h)
        info = "Install Commander"
        term.setCursorPos(w/2-string.len(info)/2,2);
        term.setTextColor(colors.blue);
        term.write(info);
        info = "Install Fire Control"
        term.setCursorPos(w/2-string.len(info)/2,3);
        term.setTextColor(colors.red);
        term.write(info);
        info = "Delete Control file"
        term.setCursorPos(w/2-string.len(info)/2,4);
        term.setTextColor(colors.black);
        term.write(info);
        local evn,but,cursx,cursy = os.pullEvent("mouse_click");
        if cursy == 2 then
            DrawBackground(w,h)
            shell.run("copy disk/firecontrollite.lua startup.lua")
            info = "Commander Software Installed"
            term.setCursorPos(w/2-string.len(info)/2,2);
            term.write(info);
            sleep(2)
            os.shutdown()
        elseif cursy == 3 then
            DrawBackground(w,h)
            shell.run("copy disk/smallcainnon.lua startup.lua")
            info = "Fire Control Installed"
            term.setCursorPos(w/2-string.len(info)/2,2);
            term.write(info);
            sleep(2)
            os.shutdown()
        elseif cursy == 4 then
            DrawBackground(w,h)
            shell.run("delete startup.lua")
            info = "File Deleted"
            term.setCursorPos(w/2-string.len(info)/2,2);
            term.write(info);
            sleep(2)
            os.shutdown()
        end
    end
end

parallel.waitForAll(Panel,watcher)