summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Propellor/Property/SiteSpecific/GitAnnexBuilder.hs29
-rw-r--r--src/Propellor/Property/SiteSpecific/JoeySites.hs43
2 files changed, 44 insertions, 28 deletions
diff --git a/src/Propellor/Property/SiteSpecific/GitAnnexBuilder.hs b/src/Propellor/Property/SiteSpecific/GitAnnexBuilder.hs
index e3d21ac1..7984a2aa 100644
--- a/src/Propellor/Property/SiteSpecific/GitAnnexBuilder.hs
+++ b/src/Propellor/Property/SiteSpecific/GitAnnexBuilder.hs
@@ -151,7 +151,7 @@ stackInstalled = withOS "stack installed" $ \w o ->
manualinstall :: Architecture -> Property Linux
manualinstall arch = tightenTargets $ check (not <$> doesFileExist binstack) $
propertyList "stack installed from upstream tarball" $ props
- & cmdProperty "wget" ["https://www.stackage.org/stack/linux-" ++ archname, "-O", tmptar]
+ & cmdProperty "wget" [url, "-O", tmptar]
`assume` MadeChange
& File.dirExists tmpdir
& cmdProperty "tar" ["xf", tmptar, "-C", tmpdir, "--strip-components=1"]
@@ -160,27 +160,30 @@ stackInstalled = withOS "stack installed" $ \w o ->
`assume` MadeChange
& cmdProperty "rm" ["-rf", tmpdir, tmptar]
`assume` MadeChange
+ & case arch of
+ ARMEL -> setupRevertableProperty $
+ "/lib/ld-linux-armhf.so.3"
+ `File.isSymlinkedTo`
+ File.LinkTarget "/lib/ld-linux.so.3"
+ _ -> doNothing
where
- -- See https://www.stackage.org/stack/ for the list of
- -- binaries.
- archname = case arch of
- X86_32 -> "i386"
- X86_64 -> "x86_64"
- ARMHF -> "arm"
+ url = case arch of
+ X86_32 -> "https://www.stackage.org/stack/linux-i386"
+ X86_64 -> "https://www.stackage.org/stack/linux-x86_64"
+ ARMEL -> "https://github.com/commercialhaskell/stack/releases/download/v1.7.1/stack-1.7.1-linux-arm.tar.gz"
-- Probably not available.
- a -> architectureToDebianArchString a
+ a -> "https://www.stackage.org/stack/linux-" ++ architectureToDebianArchString a
binstack = "/usr/bin/stack"
tmptar = "/root/stack.tar.gz"
tmpdir = "/root/stack"
-armAutoBuilder :: DebianSuite -> Architecture -> Flavor -> Property (HasInfo + Debian)
-armAutoBuilder suite arch flavor =
+armAutoBuilder :: (DebianSuite -> Architecture -> Flavor -> Property (HasInfo + Debian)) -> DebianSuite -> Architecture -> Flavor -> Property (HasInfo + Debian)
+armAutoBuilder baseautobuilder suite arch flavor =
propertyList "arm git-annex autobuilder" $ props
- & standardAutoBuilder suite arch flavor
- & buildDepsApt
+ & baseautobuilder suite arch flavor
-- Works around ghc crash with parallel builds on arm.
& (homedir </> ".cabal" </> "config")
- `File.lacksLine` "jobs: $ncpus"
+ `File.containsLine` "jobs: 1"
-- Work around https://github.com/systemd/systemd/issues/7135
& Systemd.containerCfg "--system-call-filter=set_tls"
diff --git a/src/Propellor/Property/SiteSpecific/JoeySites.hs b/src/Propellor/Property/SiteSpecific/JoeySites.hs
index 5e14d50f..4b3b06ad 100644
--- a/src/Propellor/Property/SiteSpecific/JoeySites.hs
+++ b/src/Propellor/Property/SiteSpecific/JoeySites.hs
@@ -951,6 +951,7 @@ homePower user hosts ctx sshkey = propertyList "home power" $ props
user (userGroup user)
`requires` File.dirExists (takeDirectory sshkeyfile)
`requires` Ssh.knownHost hosts "kitenet.net" user
+ & File.hasPrivContentExposed "/etc/darksky-forecast-url" anyContext
where
d = "/var/www/html/homepower"
sshkeyfile = d </> ".ssh/key"
@@ -1044,15 +1045,18 @@ homePower user hosts ctx sshkey = propertyList "home power" $ props
-- rsync server command to be updated too.
rsynccommand = "rsync -e 'ssh -i" ++ sshkeyfile ++ "' -avz rrds/ joey@kitenet.net:/srv/web/homepower.joeyh.name/rrds/"
--- My home router, running hostapd and dnsmasq for wlan0,
+homerouterWifiInterface :: String
+homerouterWifiInterface = "wlan0" -- "wlx7cdd90400448" is a wifi dongle
+
+-- My home router, running hostapd and dnsmasq,
-- with eth0 connected to a satellite modem, and a fallback ppp connection.
homeRouter :: Property (HasInfo + DebianLike)
homeRouter = propertyList "home router" $ props
- & Network.static "wlan0" (IPv4 "10.1.1.1") Nothing
+ & Network.static homerouterWifiInterface (IPv4 "10.1.1.1") Nothing
`requires` Network.cleanInterfacesFile
& Apt.installed ["hostapd"]
& File.hasContent "/etc/hostapd/hostapd.conf"
- [ "interface=wlan0"
+ [ "interface=" ++ homerouterWifiInterface
, "ssid=house"
, "hw_mode=g"
, "channel=8"
@@ -1072,7 +1076,8 @@ homeRouter = propertyList "home router" $ props
& File.hasContent "/etc/dnsmasq.conf"
[ "domain-needed"
, "bogus-priv"
- , "interface=wlan0"
+ , "interface=" ++ homerouterWifiInterface
+ , "interface=eth0"
, "domain=kitenet.net"
-- lease time is short because the homepower
-- controller wants to know when clients disconnect
@@ -1082,8 +1087,10 @@ homeRouter = propertyList "home router" $ props
, "address=/house.kitenet.net/10.1.1.1"
]
`onChange` Service.restarted "dnsmasq"
- & ipmasq "wlan0"
- & Apt.serviceInstalledRunning "netplug"
+ & ipmasq homerouterWifiInterface
+ -- Used to bring down eth0 when satellite is off, which causes ppp
+ -- to start, but I am not using this currently.
+ & Apt.removed ["netplug"]
& Network.static' "eth0" (IPv4 "192.168.1.100")
(Just (Network.Gateway (IPv4 "192.168.1.1")))
-- When satellite is down, fall back to dialup
@@ -1234,8 +1241,8 @@ homeNAS = propertyList "home NAS" $ props
newtype USBHubPort = USBHubPort Int
--- Makes a USB drive with the given label automount, with a 10 minute idle
--- timeout before it unmounts.
+-- 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.
@@ -1254,9 +1261,9 @@ autoMountDrive label (USBHubPort port) malias = propertyList desc $ props
, "After=" ++ hub
, "[Mount]"
-- avoid mounting whenever the block device is available,
- -- only want to automount on deman
+ -- only want to automount on demand
, "Options=noauto"
- , "What=/dev/disk/by-label/" ++ label
+ , "What=" ++ devfile
, "Where=" ++ mountpoint
, "[Install]"
, "WantedBy="
@@ -1269,11 +1276,16 @@ autoMountDrive label (USBHubPort port) malias = propertyList desc $ props
, "[Service]"
, "Type=oneshot"
, "RemainAfterExit=true"
- , "ExecStart=/usr/sbin/uhubctl -a on -p " ++ show port ++
- -- short sleep to give the drive time to wake up before
- -- it is mounted
- " ; /bin/sleep 20"
- , "ExecStop=/usr/sbin/uhubctl -a off -p " ++ show port
+ , "ExecStart=/usr/sbin/uhubctl -a on -p " ++ show port
+ , "ExecStop=/bin/sh -c 'uhubctl -a off -p " ++ show port ++
+ -- Powering off the port does not remove device
+ -- files, so ask udev to remove the devfile; it will
+ -- be added back after the drive next spins up
+ -- and so avoid mount happening before the drive is
+ -- spun up.
+ -- (This only works when the devfile is in
+ -- by-label.)
+ "; udevadm trigger --action=remove " ++ devfile ++ " || true'"
, "[Install]"
, "WantedBy="
]
@@ -1294,6 +1306,7 @@ autoMountDrive label (USBHubPort port) malias = propertyList desc $ props
[ "joey ALL= NOPASSWD: " ++ sudocommands
]
where
+ devfile = "/dev/disk/by-label/" ++ label
mountpoint = "/media/joey/" ++ label
desc = "auto mount " ++ mountpoint
hub = "startech-hub-port-" ++ show port ++ ".service"