diff options
Diffstat (limited to 'cokiki.hs')
-rw-r--r-- | cokiki.hs | 11 |
1 files changed, 1 insertions, 10 deletions
@@ -29,15 +29,6 @@ usage = unlines | |||
29 | , " strongswan: TODO" | 29 | , " strongswan: TODO" |
30 | ] | 30 | ] |
31 | 31 | ||
32 | ㄧchroot :: Args (FilePath -> FilePath) | ||
33 | ㄧchroot = pure (\r a -> slash r a) <*> arg "--chroot" <|> pure id | ||
34 | where | ||
35 | slash :: String -> String -> String | ||
36 | slash "/" ('/':xs) = '/':xs | ||
37 | slash "" ('/':xs) = '/':xs | ||
38 | slash "" xs = '/':xs | ||
39 | slash (y:ys) xs = y:slash ys xs | ||
40 | |||
41 | main = do | 32 | main = do |
42 | (cmd,args) <- splitAt 1 <$> getArgs | 33 | (cmd,args) <- splitAt 1 <$> getArgs |
43 | uid <- getEffectiveUserID | 34 | uid <- getEffectiveUserID |
@@ -45,7 +36,7 @@ main = do | |||
45 | | uid==0 = action | 36 | | uid==0 = action |
46 | | otherwise = hPutStrLn stderr "operation requires root." | 37 | | otherwise = hPutStrLn stderr "operation requires root." |
47 | let sel = case cmd of | 38 | let sel = case cmd of |
48 | ["ssh-client"] -> pure (sshClient uid) <*> ㄧchroot <*> Kiki.ㄧhomedir | 39 | ["ssh-client"] -> pure (sshClient uid) <*> Kiki.ㄧchroot <*> Kiki.ㄧhomedir |
49 | ["ssh-server"] -> pure (whenRoot sshServer) | 40 | ["ssh-server"] -> pure (whenRoot sshServer) |
50 | ["strongswan"] -> pure (whenRoot strongswan) | 41 | ["strongswan"] -> pure (whenRoot strongswan) |
51 | _ -> pure $ hPutStr stderr usage | 42 | _ -> pure $ hPutStr stderr usage |