address pr comments

This commit is contained in:
Aiden McClelland
2020-12-02 12:58:18 -07:00
committed by Keagan McClelland
parent 5a121945d2
commit 3ababacd91
3 changed files with 5 additions and 10 deletions

View File

@@ -4,4 +4,4 @@ Requires=docker.service
[Service] [Service]
Type=oneshot Type=oneshot
ExecStart=/bin/bash /root/restarter.sh ExecStart=/usr/local/bin/appmgr repair-app-status

View File

@@ -1,3 +0,0 @@
#!/bin/bash
exec appmgr repair-app-status

View File

@@ -540,17 +540,15 @@ replaceDerivativeCerts = do
syncRestarterService :: SyncOp syncRestarterService :: SyncOp
syncRestarterService = SyncOp "Install Restarter Service" check migrate False syncRestarterService = SyncOp "Install Restarter Service" check migrate False
where where
wantedScript = decodeUtf8 $(embedFile "config/restarter.sh") wantedService = $(embedFile "config/restarter.service")
wantedService = decodeUtf8 $(embedFile "config/restarter.service") wantedTimer = $(embedFile "config/restarter.timer")
wantedTimer = decodeUtf8 $(embedFile "config/restarter.timer")
check = do check = do
base <- asks $ appFilesystemBase . appSettings base <- asks $ appFilesystemBase . appSettings
liftIO $ not <$> doesPathExist (toS $ "/etc/systemd/system/timers.target.wants/restarter.timer" `relativeTo` base) liftIO $ not <$> doesPathExist (toS $ "/etc/systemd/system/timers.target.wants/restarter.timer" `relativeTo` base)
migrate = do migrate = do
base <- asks $ appFilesystemBase . appSettings base <- asks $ appFilesystemBase . appSettings
liftIO $ writeFile (toS $ "/usr/local/bin/restarter.sh" `relativeTo` base) wantedScript liftIO $ BS.writeFile (toS $ "/etc/systemd/system/restarter.service" `relativeTo` base) wantedService
liftIO $ writeFile (toS $ "/etc/systemd/system/restarter.service" `relativeTo` base) wantedService liftIO $ BS.writeFile (toS $ "/etc/systemd/system/restarter.timer" `relativeTo` base) wantedTimer
liftIO $ writeFile (toS $ "/etc/systemd/system/restarter.timer" `relativeTo` base) wantedTimer
liftIO . run $ systemctl "enable" "restarter.timer" liftIO . run $ systemctl "enable" "restarter.timer"
failUpdate :: S9Error -> ExceptT Void (ReaderT AgentCtx IO) () failUpdate :: S9Error -> ExceptT Void (ReaderT AgentCtx IO) ()