Non-interactive customization and installation of FreeBSD Ports - freebsd

I'm new to FreeBSD, coming from a Linux background. I want to install a port, changing one of the default configuration options, in a non-interactive way (so that I can script the installation for automated configuration of my FreeBSD servers).
As a specific example, the graphics/ImageMagick-nox11 port has a default configuration option of PERL=on. I want to change this. I realize that I can make config and then just use the generated entry in /var/db/ports/ to avoid any interaction in the future, but this still requires the initial interaction to set the options in the ncurses interface.
Ideally I want to be able to do something like the following, to build the package with perl support disabled but accepting all other defaults:
$ make PERL=off BATCH=yes install clean
What is the proper way to accomplish this? Can I somehow place port-specific configuration options like this in /etc/make.conf?

You can also unset OPTIONS via make.conf(5).
E.g.:
OPTIONS_UNSET=NLS

Related

How can my application assign a keyboard shortcut in the system from Flatpak?

I am the developer of Planner and I am having a problem assigning a keyboard shortcut to the current system.
Planner is a task manager and has a built-in application called Quick Add that through a keyboard shortcut that can be run regardless of whether Planner is running.
To install this keyboard shortcut I use the following service.
This works perfectly if I build Planner from the repository. However, I have an error if I execute the same function if I build Planner from Flatpak
** (com.github.alainm23.planner:2): WARNING **: 15:54:36.510: CustomShortcutSettings.vala:28: Schema "org.gnome.settings-daemon.plugins.media-keys" is not installed on your system.
I know that I can't access the scheme of org.gnome.settings-daemon.plugins.media-key And I need a hole to edit the dfcon configuration of the system.
The question is how can I do that. If anyone could help me I would be very grateful.
Flatpak by default doesn't allow editing GSettings in a way that affects the rest of the desktop, since rouge applications could use that ability to do things with security and privacy implications, like set or unset proxy servers.
So it would be best to look into alternative ways to make this possible - perhaps provide people with instructions to set it up manually, or request and/or contribute proper portal support for setting global keyboard shortcuts.
If you still really want to implement this, check the link above for the details on the sandbox hole you need to open to make it work.

Set Linux Proxy Without Restarting System

I tried to change my proxy in my machine since in office they use proxy and I’m not using proxy at home. So everyday I come to the office and setup the proxy using this nice tools. Though it is good but it requires restart in order to get all proxies applied.
Basically I know that the way to set proxy in Linux is modifying /etc/environment and add http_proxy values (or https_proxy for ssl), and also add no_proxy if you want to bypass some host/IP’s. The ProxyMan tool which I’ve mentioned before is basically do the same thing, but in interactive way. But still, it requires restarts to apply it all.
What I want to ask is, can we apply changes of proxy settings without restarting the machine?
Thanks…
The only time /etc/environment file is read is on login, when the PAM stack is activated.
In deeper, its pam_env.so, which reads the file.
Edit /etc/pam.d/sudo (e.g., sudo vim /etc/pam.d/sudo) and change auth to session at the start of the following line:
auth required pam_env.so readenv=1 user_readenv=0
So it should become:
session required pam_env.so readenv=1 user_readenv=0
If you use a graphical environment, you can use a tool I have developed recently; it is hosted at https://github.com/okelet/proxychanger.

Conditional proxy settings in gradle.properties

I use Android Studio and gradle in my office using a authenticated corporate proxy. This unfortunately means that I have to enter my proxy config including user/pass in cleartext in gradle.properties (or have it automatically propagated from Android Studio's preferences).
However, sometimes I work outside of the office, and I then have to manually go in and comment out my proxy settings each time, which is tedious.
Is there a way to make properties in a gradle file conditional so that the proxy configuration can be automatically activated by detecting if I'm on my corporate network or not? The condition itself could in turn be retrieved either by querying the network adapter for the current network, or perhaps better, by making a simple curl to a known host on my corporate network.
I'm using both Windows and Ubuntu clients but this question mostly applies to Windows.
There might be other ways to solve this I guess, perhaps changing the global gradle settings rather than the project specific ones. To be honest, I have to do a similar git config --add http.proxy, and the same for npm, bower and what not, everytime I change working environments. Other suggestions are welcome even though this question specifically asks how to create a gradle.properties which tries to connect to a known intranet host, and depending on the outcome sets or unsets properties.
I have had the same problem for a while. There was an additional problem for me that gradle.properties are checked in to our VCS with a proxy setting; and I had to take extra steps before all my commits to ignore the changes I did in that file. Additionally, I had to comment/uncomment the same piece of code multiple times in a day.
I could not come up with a conditional update system, but the second problem was resolved by inbuilt shelving functionality in Android Studio and creating changelists to keep 2 copies of the file with different settings.
I don't think there is any way to solve this problem the way you are asking for. For a simple reason: .properties files are not meant to have logic. To quote the Java docs:
Properties are configuration values managed as key/value pairs.
The dynamic settings can be achieved either via Android Studio proxy settings or writing a Gradle task that runs on project load, checks network conditions and sets system properties. I haven't tested this approach, but I think this will also update the gradle.properties file (a side-effect that you may not want). But what is being done by Gradle can also be done via a shell script that you need to execute on project load.
The way I am currently handling proxy update is by entering/saving the proxy settings in Android Studio itself, and toggling when I move between locations. It just takes a couple of commands to bring up the proxy dialog and enable/disable the saved proxy.
Since this proxy file is saved in idea.config.path/options/proxy.settings.xml, you could also try writing a shell script that can toggle the contents based on network availability.
This may not be what you were looking for, but I hope it clears up why it can't be done the way you asked for.

Bamboo 5.5.0 - How to delete a remote agent's capability via the bamboo-capabilities.properties file?

I am currently trying to automate the process of bamboo remote agent installation and uninstallation. I have run into a problem in regards to adding and removing capabilities.
What I am trying to automate:
(The following is what I do on the bamboo server via the GUI, I want to do this on the remote agent machine via bash script.)
I install the remote agent on a VM machine, then start it up. I go to the bamboo interface and click on the newly created agent's name.
I add a custom capability type, for the key I put 'buildserver' and for the value I put the name of the agent.
I add an 'Executable' capability of type 'Command' with Executable label 'cygwin' and path 'C:\cygwin64\bin\bash'
I navigate to the git executable, and remove it by clicking 'delete.' <--- (the problem step)
what I've done.
I have looked here and found a way to automate steps 1-3 using the following "bamboo-capabilities.properties" file:
buildserver="AGENTNAME"
system.builder.command.cygwin="C:\cygwin64\bin\bash"
However I am stuck on how I would remove the git capability (step 4.) I've tried something appending something like this to the file:
system.git.executable=""
but it does not seem to do anything. Does anyone know how I would do this? There seems to be very little documentation about this online.
Thanks very much.
I never found a way to get around this, but I found a workaround. I later learned the point of removing git in my situation was to allow a shared capability that was also called git to take precedence. My workaround was to set the non-shared capability to the value of the shared capability. I am not 100% sure that this does the same thing, and I am not in a position to test it yet, but as a capability seems to be only a key-value pair I don't see why it wouldn't.... will update if anything breaks.

Linux: how to set up proxy using pac script

I am using Red Hat Enterprise Linux Server release 6.2, and I have only terminal access (no GUI). My company has a proxy auto-config script (PAC), and that is the only way to get internet connection.
I had no problem with my windows machine, since it was easy to set it up in IE->Tools->Internet Options. But in Linux, especially without a GUI, there seems to be no way to use this PAC script (I have been Googling for a while). By the way, the script is over 400 lines of Javascript.
Anyone knows how to solve this problem?
Proxy settings are implemented differently according to the software you use. On graphical desktop environments there are setup tools to configure a PAC; browsers like Chromium and Firefox detect the current desktop environment and import the proxy settings from there; Firefox also used to offer options for manual configuration of proxies and PAC URLs.
Integration of proxy options is not a priority for developers of text-only software packages. Each one of your tools will have to be manually configured to use a proxy. For example, APT must have a proxy configuration file at /etc/apt/apt.conf.d/.
Some packages may consult the environment variables http_proxy, https_proxy, et al, for proxy configuration.
You will need to read the documentation of the packages you will use in your GUI-less Linux to learn how to configure each of them to use the company's proxy. Some packages will use protocols and ports other than HTTP(S), FTP, GOPHER, which may be forbidden by the company's firewall.
I know this is an old thread.
In my case, I did the following steps
Download the automatic configuration script and copy proxy address from that file.
export "http_proxy" and "https_proxy" in bashrc using the proxy address get from step 1
Reload bashrc file
use the PAC even in the terminal environment. it works.

Resources