summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoey Hess2020-07-31 11:32:37 -0400
committerJoey Hess2020-07-31 11:32:37 -0400
commitf26dcc88f26020625e2ee3201e29250f26b55261 (patch)
tree154fee3a8bcbd5b443894ff7d34b84895cbd38d5
parent886a3483f012a4cd18fff150ec2ed61f166e1e30 (diff)
parent145d6f78ab94a1ca9ac556b518417fe4b2124be3 (diff)
Merge branch 'joeyconfig'
l---------config.hs2
-rw-r--r--doc/todo/cabal_new-build_cruft.mdwn17
-rw-r--r--privdata/relocate1
-rw-r--r--src/Propellor/Property/SiteSpecific/JoeySites.hs44
-rw-r--r--src/Propellor/Types/Dns.hs2
5 files changed, 54 insertions, 12 deletions
diff --git a/config.hs b/config.hs
index ec313725..97d90636 120000
--- a/config.hs
+++ b/config.hs
@@ -1 +1 @@
-config-simple.hs \ No newline at end of file
+joeyconfig.hs \ No newline at end of file
diff --git a/doc/todo/cabal_new-build_cruft.mdwn b/doc/todo/cabal_new-build_cruft.mdwn
new file mode 100644
index 00000000..586e9fde
--- /dev/null
+++ b/doc/todo/cabal_new-build_cruft.mdwn
@@ -0,0 +1,17 @@
+cabal new-build (now the default with recent cabal versions) stores stuff
+in dist-newstyle, versioned by the ghc version and the package version.
+
+So, as propellor builds itself on a host over and over again,
+and the host is upgraded and propellor is upgraded, dist-newstyle will
+accumulate cruft used by old builds.
+
+cabal clean can remove it of course, but then it won't update the build
+incrementally.
+
+What would be good is, a way to detect that the versioning has changed,
+and only then run cabal clean. One way to do that, would be when updating
+the propellor symlink to the cabal built binary, compare the old and new
+binary location. If they're not the same, the versioning has changed,
+and so cabal clean and re-build. --[[Joey]]
+
+(Note that stack probably has the same problem too.)
diff --git a/privdata/relocate b/privdata/relocate
new file mode 100644
index 00000000..271692d8
--- /dev/null
+++ b/privdata/relocate
@@ -0,0 +1 @@
+.joeyconfig
diff --git a/src/Propellor/Property/SiteSpecific/JoeySites.hs b/src/Propellor/Property/SiteSpecific/JoeySites.hs
index 9b8a7e70..64bee99d 100644
--- a/src/Propellor/Property/SiteSpecific/JoeySites.hs
+++ b/src/Propellor/Property/SiteSpecific/JoeySites.hs
@@ -1238,33 +1238,46 @@ homeNAS = propertyList "home NAS" $ props
[ "# let users power control startech hub with uhubctl"
, "ATTR{idVendor}==\"" ++ hubvendor ++ "\", ATTR{idProduct}==\"005a\", MODE=\"0666\""
]
- & autoMountDrivePort "archive-10" (USBHubPort hubvendor hubloc 1)
+ & autoMountDrivePort "archive-10"
+ (USBHubPort hubvendor 1)
+ (USBDriveId wd "1230")
(Just "archive-oldest")
- & autoMountDrivePort "archive-11" (USBHubPort hubvendor hubloc 2)
+ & autoMountDrivePort "archive-11"
+ (USBHubPort hubvendor 2)
+ (USBDriveId wd "25ee")
(Just "archive-older")
- & autoMountDrivePort "archive-12" (USBHubPort hubvendor hubloc 3)
+ & autoMountDrivePort "archive-12"
+ (USBHubPort hubvendor 3)
+ (USBDriveId seagate "3322")
(Just "archive-old")
- & autoMountDrivePort "archive-13" (USBHubPort hubvendor hubloc 4)
+ & autoMountDrivePort "archive-13"
+ (USBHubPort hubvendor 4)
+ (USBDriveId wd "25a3")
(Just "archive")
& autoMountDrive "passport" Nothing
& Apt.installed ["git-annex", "borgbackup"]
where
hubvendor = "0409"
- hubloc = "4-1.6"
+ wd = "1058"
+ seagate = "0bc2"
data USBHubPort = USBHubPort
{ hubVendor :: String
- , hubLocation :: String
, hubPort :: Int
}
+data USBDriveId = USBDriveId
+ { driveVendorId :: String
+ , driveProductId :: String
+ }
+
-- Makes a USB drive with the given label automount, and unmount after idle
-- for a while.
--
-- The hub port is turned on and off automatically as needed, using
-- uhubctl.
-autoMountDrivePort :: Mount.Label -> USBHubPort -> Maybe FilePath -> Property DebianLike
-autoMountDrivePort label hp malias = propertyList desc $ props
+autoMountDrivePort :: Mount.Label -> USBHubPort -> USBDriveId -> Maybe FilePath -> Property DebianLike
+autoMountDrivePort label hp drive malias = propertyList desc $ props
& File.hasContent ("/etc/systemd/system/" ++ hub)
[ "[Unit]"
, "Description=Startech usb hub port " ++ show (hubPort hp)
@@ -1272,7 +1285,7 @@ autoMountDrivePort label hp malias = propertyList desc $ props
, "[Service]"
, "Type=oneshot"
, "RemainAfterExit=true"
- , "ExecStart=/usr/sbin/uhubctl -a on " ++ selecthubport
+ , "ExecStart=/bin/sh -c 'uhubctl -a on " ++ selecthubport ++ "'"
, "ExecStop=/bin/sh -c 'uhubctl -a off " ++ selecthubport
-- Powering off the port does not remove device
-- files, so ask udev to remove the devfile; it will
@@ -1300,7 +1313,18 @@ autoMountDrivePort label hp malias = propertyList desc $ props
selecthubport = unwords
[ "-p", show (hubPort hp)
, "-n", hubVendor hp
- , "-l", hubLocation hp
+ , "-l", concat
+ -- The hub's location id, eg "1-1.4", does not seem
+ -- as stable as uhubctl claims it will be,
+ -- and the vendor is not sufficient since I have 2
+ -- hubs from the same vendor. So search for the
+ -- drive lsusb to find that. This works even if the
+ -- port is powered off, as long as it's been on at
+ -- some point before.
+ [ "$(lsusb -tvv | perl -lne \"if (\\\\$h && m!/sys/bus/usb/devices/(.*?) !) {\\\\$v=\\\\$1}; if (m/Hub/) { \\\\$h=1 } else { \\\\$h=0 }; if (/"
+ , driveVendorId drive ++ ":" ++ driveProductId drive
+ ++ "/) { print \\\\$v; last}\")"
+ ]
]
-- Makes a USB drive with the given label automount, and unmount after idle
diff --git a/src/Propellor/Types/Dns.hs b/src/Propellor/Types/Dns.hs
index 30302a7d..e9902513 100644
--- a/src/Propellor/Types/Dns.hs
+++ b/src/Propellor/Types/Dns.hs
@@ -181,7 +181,7 @@ newtype NamedConfMap = NamedConfMap (M.Map Domain NamedConf)
instance IsInfo NamedConfMap where
propagateInfo _ = PropagateInfo False
--- | Adding a Master NamedConf stanza for a particulr domain always
+-- | Adding a Master NamedConf stanza for a particular domain always
-- overrides an existing Secondary stanza for that domain, while a
-- Secondary stanza is only added when there is no existing Master stanza.
instance Sem.Semigroup NamedConfMap where