From 8d31a6226ac9e1dfc75ec7521f039a43e749ed82 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 30 Mar 2014 15:14:36 -0400 Subject: [PATCH] remove VPS cruft --- .gitignore | 3 +++ Propellor.hs | 3 +++ Property/File.hs | 8 ++++++++ 3 files changed, 14 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..245a2ac --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +dist/* +propellor +tags diff --git a/Propellor.hs b/Propellor.hs index 91f130e..ea2188f 100644 --- a/Propellor.hs +++ b/Propellor.hs @@ -64,4 +64,7 @@ cleanCloudAtCost hostname = propertyList "cloudatcost cleanup" , "/etc/default/grub" `File.containsLine` "GRUB_DISABLE_LINUX_UUID=true" `onChange` cmdProperty "update-grub" [] `onChange` cmdProperty "update-initramfs" [Param "-u"] + -- Cruft + , File.notPresent "/etc/rc.local" + , File.notPresent "/etc/init.d/S97-setup.sh" ] diff --git a/Property/File.hs b/Property/File.hs index a4b2196..9d07f13 100644 --- a/Property/File.hs +++ b/Property/File.hs @@ -1,6 +1,9 @@ module Property.File where +import System.Directory + import Property +import Utility.Directory {- Replaces all the content of a file. -} hasContent :: FilePath -> [Line] -> Property @@ -20,3 +23,8 @@ f `containsLine` l = FileProperty (f ++ " contains:" ++ l) f go - file will be written. -} lacksLine :: FilePath -> Line -> Property f `lacksLine` l = FileProperty (f ++ " remove: " ++ l) f (filter (/= l)) + +{- Note: Does not remove symlinks or non-plain-files. -} +notPresent :: FilePath -> Property +notPresent f = check (doesFileExist f) $ IOProperty (f ++ " not present") $ + makeChange $ nukeFile f