You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If I say, need [ "a/b/c/d/foo"] does shake automatically create a/b/c/d/ directory? Is there any way to turn this behaviour off on a case-by-case basis?
Use-cases:
I want to make sure that a user has been created on a system, and I'm using /home/<username>/.bashrc as a target file for this action. However, because shake seems to be automatically creating /home/<username> the useradd command refuses to initialize the user's home-dir and the .bashrc file doesn't get automatically created.
I want to make sure that /usr/share/elasticsearch/bin/elasticsearch is available on a system. If not, it is "produced" by sudo dpkg -i elasticsearch.deb command. However, before this command can be run, shake tries to create /usr/share/elasticsearch/bin and runs into permission errors.
The text was updated successfully, but these errors were encountered:
It's not the need that automatically creates the file, but the rule itself, so when you give a rule for producing a/b/c/d/foo, that rule, before it runs any of the user-supplied code, will first create the containing directory. There is no way to turn that off. One way to deal with these things specially would be to use oracles or similar, so define an oracle rule for creating a user, and then have that do what you need. Also, generally Shake should be creating things in a defined output directory, so not sure it messing around in /home or /usr/share is going to be a good plan - although I don't think anything will actually go wrong because of that.
newtype User = User String deriving (Show,Typeable,Eq,Hashable,Binary,NFData)
type instance RuleResult User = (
rules = do
addOracle $ \(User x) -> do
cmd "adduser" x
If you really want to track the .bashrc in the users home directory, so that it will rerun if the user edits it, you can add the need inside the addOracle after the execution of adduser, which will ensure it always gets run first.
Also, generally Shake should be creating things in a defined output directory, so not sure it messing around in /home or /usr/share is going to be a good plan - although I don't think anything will actually go wrong because of that.
I'm experimenting with using Shake as a replacement for server provisioning tools to consolidate the number of tools required in a large-ish project. Bad idea?
If I say,
need [ "a/b/c/d/foo"]
does shake automatically createa/b/c/d/
directory? Is there any way to turn this behaviour off on a case-by-case basis?Use-cases:
/home/<username>/.bashrc
as a target file for this action. However, because shake seems to be automatically creating/home/<username>
theuseradd
command refuses to initialize the user's home-dir and the.bashrc
file doesn't get automatically created./usr/share/elasticsearch/bin/elasticsearch
is available on a system. If not, it is "produced" bysudo dpkg -i elasticsearch.deb
command. However, before this command can be run,shake
tries to create/usr/share/elasticsearch/bin
and runs into permission errors.The text was updated successfully, but these errors were encountered: