diff options
| author | Joey Hess <joeyh@joeyh.name> | 2017-02-15 15:22:13 -0400 |
|---|---|---|
| committer | Joey Hess <joeyh@joeyh.name> | 2017-02-15 15:22:13 -0400 |
| commit | 4f29d576115d1bcbed60eacb3642523f1b5f480f (patch) | |
| tree | cb4b5ada932bbdea7c4ee97008fc871cd810b543 /doc/forum/Inherited_Variables... | |
| parent | 6e3192f0d2e063f07d7a5d2b96648e9167cc576a (diff) | |
| parent | b29bab35747e6345a4818e5a77c53d029562e3c3 (diff) | |
Merge branch 'master' into joeyconfig
Diffstat (limited to 'doc/forum/Inherited_Variables...')
5 files changed, 79 insertions, 0 deletions
diff --git a/doc/forum/Inherited_Variables.../comment_1_082e5d5b8e25335bc90577abcfef1d21._comment b/doc/forum/Inherited_Variables.../comment_1_082e5d5b8e25335bc90577abcfef1d21._comment new file mode 100644 index 00000000..e4b32398 --- /dev/null +++ b/doc/forum/Inherited_Variables.../comment_1_082e5d5b8e25335bc90577abcfef1d21._comment @@ -0,0 +1,15 @@ +[[!comment format=mdwn + username="joey" + subject="""comment 1""" + date="2017-01-26T06:39:35Z" + content=""" +This is where propellor's `Info` system comes in. `Propellor.Info.getOS` +can be run to get the OS info. + +It's also possible to add new properties that add new values with custom +types to `Info`. + +The hostname is not currently stored in `Info`, but it probably should be; +that would be a good simplification. Currently there's a +separate way to get the hostname: `asks hostName` (run in the Propellor monad) +"""]] diff --git a/doc/forum/Inherited_Variables.../comment_2_988319ed6de46eff2eac0d5ef36382f9._comment b/doc/forum/Inherited_Variables.../comment_2_988319ed6de46eff2eac0d5ef36382f9._comment new file mode 100644 index 00000000..676f41ac --- /dev/null +++ b/doc/forum/Inherited_Variables.../comment_2_988319ed6de46eff2eac0d5ef36382f9._comment @@ -0,0 +1,15 @@ +[[!comment format=mdwn + username="joey" + subject="""comment 2""" + date="2017-01-26T06:50:39Z" + content=""" +A worked example: + + server :: Property Debian + server = property' "some description" $ \w -> do + os <- getOS + hostname <- asks hostName + ensureProperty w $ + File.hasContent "/etc/apt/sources.list.d/matrix.list" + (genSourcesList os hostname) +"""]] diff --git a/doc/forum/Inherited_Variables.../comment_3_acf78fa9f732f070bf73c2ab601464ee._comment b/doc/forum/Inherited_Variables.../comment_3_acf78fa9f732f070bf73c2ab601464ee._comment new file mode 100644 index 00000000..fcdf923b --- /dev/null +++ b/doc/forum/Inherited_Variables.../comment_3_acf78fa9f732f070bf73c2ab601464ee._comment @@ -0,0 +1,8 @@ +[[!comment format=mdwn + username="craige" + avatar="http://cdn.libravatar.org/avatar/64ac5816ea3a51347d1f699022d1fdc1" + subject="Thanks!" + date="2017-01-27T21:54:45Z" + content=""" +Thanks Joey. I think that's exactly what I need. Very helpful :-) +"""]] diff --git a/doc/forum/Inherited_Variables.../comment_4_5bf7b1f69b48b4d9c516d424e4438208._comment b/doc/forum/Inherited_Variables.../comment_4_5bf7b1f69b48b4d9c516d424e4438208._comment new file mode 100644 index 00000000..3b691b2a --- /dev/null +++ b/doc/forum/Inherited_Variables.../comment_4_5bf7b1f69b48b4d9c516d424e4438208._comment @@ -0,0 +1,21 @@ +[[!comment format=mdwn + username="craige@a46118dff5bc0fad85259759970d8b4b9fc377d7" + nickname="craige" + avatar="http://cdn.libravatar.org/avatar/6d2207226de755da46aa2fdff9af70b2" + subject="comment 4" + date="2017-02-03T00:04:05Z" + content=""" +Ugh, sorry to ask again but I'm specifically stuck trying to extract the Debian suite only from this. Is this stored as a specific value I can draw on? I've been wading through the source and added in a swag of trial and error with no luck. + +I can see the suite listed in the output + + Just (System (Debian Linux (Stable \"jessie\")) + +but I was wondering if there was a method to pull out just the suite code name (ie: \"jessie\") that did not involve a regex looking for it amongst that output. + +The goal is to query Info so that a suite name can be added to a sources list. + +If I have to regex, that's OK, I just didn't want to go down that path if there was a smarted way. + +Thanks Joey :-) +"""]] diff --git a/doc/forum/Inherited_Variables.../comment_5_6fbd29f568ec8b97be47874e2aac57a3._comment b/doc/forum/Inherited_Variables.../comment_5_6fbd29f568ec8b97be47874e2aac57a3._comment new file mode 100644 index 00000000..16819bd6 --- /dev/null +++ b/doc/forum/Inherited_Variables.../comment_5_6fbd29f568ec8b97be47874e2aac57a3._comment @@ -0,0 +1,20 @@ +[[!comment format=mdwn + username="joey" + subject="""comment 5""" + date="2017-02-03T19:32:58Z" + content=""" +What you're looking for is not a regexp, but Haskell's [pattern +matching](https://www.haskell.org/tutorial/patterns.html). + +For example: + + myproperty :: Property Debian + myproperty = withOS "some desc here" $ \w o -> case o of + -- Pattern match on the OS, to get the Debian stable release + (Just (System (Debian _kernel (Stable release)) _arch)) -> + ensureProperty w $ Apt.setSourcesListD (sourcesLines release) "mysources" + _ -> unsupportedOS + + sourcesLines :: Release -> [Line] + sourcesLines release = undefined +"""]] |
