How to provide custom config for ImageMagick AppImage - imagemagick

Currently I am downloading the ImageMagick AppImage provided on the releases page to /usr/local/bin. (It needs to be accessible to multiple users.) I would like to provide a custom policy.xml config file but am not sure where to put it.
The docs state:
Under Linux and Linux, ImageMagick searches for each of the configuration files listed above by looking in the locations given below, in order, and loads them if found:
$MAGICK_CONFIGURE_PATH
$PREFIX/etc/ImageMagick-7
$PREFIX/share/ImageMagick-7
$XDG_CACHE_HOME/ImageMagick
$HOME/.config/ImageMagick
<client path>/etc/ImageMagick
The environmental variable $PREFIX is the default install path (e.g. /usr/local). The client path is the execution path of your ImageMagick client (e.g. /usr/local) .
I was hoping to avoid having to use $MAGICK_CONFIGURE_PATH but am currently.
I did try putting the the policy.xml file under /usr/local/etc/ImageMagick-7 and /usr/local/share/ImageMagick-7, but $ magick -list policy showed the config still goes undetected. Here is the output:
$ magick -list policy
Path: /tmp/.mount_magickrmRmxG/usr/etc/ImageMagick-7/policy.xml
Policy: Undefined
rights: None
Path: [built-in]
Policy: Undefined
rights: None
Is there a directory where global config can be placed under the given setup that will be automatically detected?

Related

ZSH: do not regard subfolders contained in folders listed in $PATH as executables

Can ZSH be configured so that, just like Bash, it disregards subdirectories contained in the directories listed in $PATH?
According to Bart Schaefer seemingly the subfolders contained in the folders listed in $PATH are handled like executables in ZSH (whereas Bash disconsiders them).
For example, if $PATH contains the folder /usr/local/bin and there is a subfolder md5 in /usr/local/bin (but no such executable in a path of $PATH after it), then typing md5 and Enter gives the response zsh: permission denied: (instead of command not found in Bash) because md5 is not a command, but a directory.
This can bite you, for example, when a script checks on Linux whether the command md5 is available (as it is, by default on MacOS), and zsh wrongly returns true (the proper command would be md5sum). This is a frequent issue on WSL which converts and appends all paths in %PATH% to $PATH.
Similar questions have been asked in "zsh: permission denied: gam" and "Weird rails error "permission denied: bin/rails" for old rails apps", but the answers did not get to the heart of the matter.

Ansible: How to globally set PATH for solaris

I am writing Ansible playbooks to setup and install our applications on Solaris servers.
The problem is that the (bash) scripts which I need to execute all assume that a certain directory lies on the PATH, namely /data/bin - which would normally not be a problem were it not for Ansible ignoring all the .profile and .bashrc config.
Now, I know that you can specify the environment for shell tasks via the environment flag, for example like this:
- shell: printenv
environment:
PATH: /usr/bin:/usr/sbin:/data/bin
This will properly path the /data/bin folder, and the printenv command will correctly display (or my bash scripts would correctly run).
But. There are two problems however:
First of all it is very annoying to have to specify the environment over and over again. I know that you can define the environment in some playbook base file variable and the reference that, but you still have to set environment: ... on every single shell task.
Secondly, the above example does not allow me to specify the path dynamically, e.g. as PATH: $PATH:/data/bin - because Ansible executes this in a way which does not resolve $PATH, thus the command fails catastrophically. So essentially this will override any other changes to PATH.
I am looking for a solution where
the additional PATH entry should only be added once
the additional PATH entry should not override entries added by other tasks
P.S. I found this nice explanation on how to do this on Linux, but it makes use of /etc/environment which does not exist on Solaris. (And /etc/profile is once again ignored by Ansible.)
try adding -o SendEnv=PATH to ssh_args in ansible.cfg. Requires that
the shell in which you run ansible has /data/bin in PATH. Or however ansible allows you to modify the current/local PATH variable.
remote machine has AcceptEnv set correctly.

Getting Rsync 3.0.9 to work on Vagrant VM box through Cygwin on windows 7

My vagrant VM box is super slow when I try to run my Rails app on it, and I'm guessing it's due to the shared folder problem.
I am trying to use rsync to circumvent the problem.
I installed Cygwin and necessary packages, put C:\cygwin64\bin; as PATH environment variable
and then changed my Vagrantfile to
config.vm.synced_folder ".", "/vagrant", type: "rsync"
When I run vagrant up, I Get this error message
$ vagrant up Bringing machine 'default' up with 'virtualbox'
provider... "rsync" could not be found on your PATH. Make sure that
rsync is properly installed on your system and available on the PATH.
What's going wrong here?
Thank you so much ... if there's any other way to run Vagrant VM box smoothly and faster on Windows 7, I would love to hear it too.
This turned out to be a bunch of brick-walls you have to circumvent when installing Rsync and setting it up correctly for Vagrant on Windows 7.
First of all, the error "rsync" could not be found on your PATH. Make sure that rsync is properly installed on your system and available on the PATH. was due to the fact that
1) Environment variable for Cygwin was placed in the latest order in the PATH, I changed it to the beginning of the path
2) During installation of Cygwin and Rsync, I installed individual "subpackages" instead of installing everything, thinking that it would be okay. Turns out I was wrong. I installed everything in the Admin package and Net package (not the SRC but just the bins), and then it started working. I suggest you set-up Cygwin again and really try to download everything if you see that error.
(I found these solutions through this post on SO cygwin + rsync)
Now, I could go into CMD and type rsync, and it would show up correctly. But then when I ran vagrant up it gave me another error saying
There was an error when attempting to rsync a synced folder. Please inspect the error message below for more info.
Host path: /c/Users/xxxxx Guest path: /vagrant
Command: rsync --verbose --archive --delete -z --copy-links
--chmod=ugo=rwX --no-perms --no-owner --no-group --rsync-path sudo rsync -e ssh -p 2222 -o StrictHostKeyCh
/c/Users/xxxx / vagrant#127.0.0.1:/vagrant
Error: cygwin warning: MS-DOS style path detected:
C:/Users/xxxxxxx Preferred POSIX
equivalent is:
/cygdrive/c/Users/xxxx CYGWIN
environment variable option "nodosfilewarning" turns off this warning.
Consult the user's guide for more details about POSIX paths:
http://cygwin.com/cygwin-ug-net/using.html#using-pathnames Warning: Permanently added '[127.0.0.1]:2222' (ECDSA) to the list of
known hosts. rsync: change_dir "/c/Users/xxxxxxx"
failed: No such file or directory (2) rsync error: some files/attrs
were not transferred (see previous errors) (code 23) at
/usr/src/ports/rsync/rsync-3.0.9-1/src/rsync-3.0.9/main.c(1052)
[sender=3.0.9]
I googled solution to this error and found this site. https://github.com/mitchellh/vagrant/issues/3230
Then there's a bug with Vagrant and cwrsync that I mentioned in #3086.
For now, just edit
C:\HashiCorp\Vagrant\embedded\gems\gems\vagrant-1.5.1\plugins\synced_folders\rsync\helper.rb
and add hostpath = "/cygdrive" + hostpath to line 74. It's a terrible
solution but quick and simple.
Editing that helper.rb file and adding hostpath at line 74 (just made some blank lines right there and pasted it in) and now it works perfectly!!!!
Rsync makes the shared folder soooooo much faster on Rails!!!! I think it is worth the pain of setting it up correctly. Try it!!
It's not clear from your message, but I think you installed rsync on your machine (the host), while it needs to be installed on the virtual machine you bringing up (the guest).

Run script from dock in Mac OS X

I am developing web applications using Ruby on Rails and Sublime Text 3 on OS X 10.8.4. I recently installed the package RubyTest. The tests only work when Sublime is launched using the command
subl
in terminal. Otherwise I get the error message:
/bin/sh: rspec: command not found
I think that's meant to be the case; that's implied in RubyTest's readme file on github.
However I'd like to retain the ability to launch from the dock. Is there a way I can do this?
Unfortunately, OSX applications do not pick up on your $PATH variable set in Terminal. To change the internal PATH settings in Mountain Lion (this method hasn't been tested with previous versions, although it should work), you'll need to edit /etc/launchd.conf:
Make sure you have admin privileges.
Open Terminal or your favorite substitute and see if there's anything in the file /etc/launchd.conf:
cat /etc/launchd.conf
If you get an error like
cat: /etc/launchd.con: No such file or directory
then continue with the next step. If the cat command does display some content, copy it to the clipboard.
Create a new text file with the following content, modified to fit your needs:
setenv PATH /usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin:/Users/YourUserName/bin:/path/to/gems/bin
If the cat command displayed some content in the previous step, paste it into the new file before the setenv PATH command. If it already contains a setenv PATH command, just modify it to add the directories you need, such as /path/to/gems/bin
Save the new file in your home directory (/Users/YourUserName) as launchd.conf.
Go back to Terminal and enter:
sudo mv ~/launchd.conf /etc
to use admin power to move the new file to /etc, replacing anything that was there before. Depending on your previous usage of the sudo command, you may get a short "be careful doing what you're doing" message, but either way you'll need to enter your password. /etc is not directly accessible through the Save dialog unless you're a real power user and know how to get around OSX's file system restrictions.
Reboot your computer
And you should be all set. If you're interested, launchd and launchctl use the csh/tcsh syntax, so you can't use the bash/zsh export PATH=/usr/local/bin:... format.

Bash Command which Rails does Not Find

Passenger says:
Ruby on Rails application could not be started
...
Command 'exiftool' not found (MiniExiftool::Error)
When I login with ssh and I type exiftool in any directory the command works properly.
I have the follwing line in both .bash_profile and .bashrc
export PATH=$PATH:$HOME/bin
Is it possible that Rails (MiniExiftool plugin) does not recognize that bash command? How can I fix this behaviour?
The PATH for the user your server runs as does not include the directory that exiftool is in. You can either add it to that user's path, or you can refer to exiftool using its full path. I'd recommend this second approach for reasons of security. There are a number of attacks that involve putting trojan horses in a user's path ahead of the directories where the real binaries live.

Resources