Ferry Boender

Programmer, DevOpper, Open Source enthusiast.


Category: shell scripting

How to solve RPMs created by Alien having file conflicts

I generate release packages for my software with Alien, which amongst other things converts .deb packages to .rpm. On Fedora 24 however, the generated RPMs cause a small problem when installed with Yum: Transaction check error: file / from install of cfgtrack-1.0-2.noarch conflicts with file from package filesystem-3.2-20.el7.x86_64 file /usr/bin from install of cfgtrack-1.0-2.noarch conflicts […]

Multi-repo Git status checking script

I've got a whole bunch of Git repositories in my ~/Projects/ directory. All of those may have unstaged, uncommitted or unpushed changes. I find this hard to keep track of properly, so I wrote a script to do this for me. The output looks like this: As you can see, it shows: Untracked files: File that […]

cfgtrack: A simpel tool that tracks and reports diffs in files between invocations.

Sometimes other people change configurations on machines that I help administer. Unfortunately, I wouldn't know when they changed something or what they changed. There are many tools available to track configuration changes, but most are way overpowered. As a result they require too much time to set up and configure properly. All I want is […]

Alien Deb to RPM convert fails with error: "Use of uninitialized value in split…" [FIXED]

TL;DR: Run alien under the script tool. I was trying to get my build server to build packages for one of my projects. One step involves converting a Debian package to a RPM by means of the Alien tool. Unfortunately it failed with the following error: alien -r -g ansible-cmdb-9.99.deb Warning: alien is not running as root! […]

Batch create new users on Linux

A while ago I had to create many new users on a Linux machine. Since I'm lazy, I opted to automate this process. The newusers command combined with pwgen (to generate new passwords) was the solution. First I installed pwgen, a utility to automatically generate passwords: $ sudo apt-get install pwgen I created a file […]

I've released cfgtrack v1.0: Get notified of changes on your server

I needed a simple way of being notified when configuration files had been changed on some servers. Nothing fancy. No configuration management, no intrusion detection, no centralised versioning control repositories. Just a simple email saying what's been changed. I couldn't find a tool that did just that, and didn't require massive amounts of configuration, so I […]

Script to start a Chrome browser with an SSH Socks5 proxy

Socks5 proxies are great. They allow you to tunnel all traffic for applications that support Socks proxies through the proxy. One example I frequently use is starting a Chrome window that will do everthing as if it was an a remote machine. This is especially useful to bypass firewalls so you can test websites that […]

Read the POSIX standard

Stop reading your local manual pages when programming/scripting stuff, and use the POSIX standard instead: Online POSIX 2008 (EEE Std 1003.1-2008) standard There are four main parts: The Base Definitions (XBD): The basics of a POSIX-compliant system. The System Interfaces (XSH): What POSIX-compliant systems offer to programs. I.e. programming in C (stdlib) The Shell & […]

Excluding results of a 'find' command (inverting tests)

In kind of a follow up to my previous post on using find and sed to search and replace multiple files, I found out something else. I needed to find and replace something in every file, except for any files which had ".svn" in them. After struggling for a few fruitless minutes with -regex, I […]

Linux search and replace

I always kept a small Python script around for searching and replacing in Linux. Turns out that GNU sed has an inline edit mode which I didn't know about: -i[SUFFIX], –in-place[=SUFFIX] edit files in place (makes backup if extension supplied) This makes searching and replacing in files as simple as: find . -name "*.txt" -print0 […]

The text of all posts on this blog, unless specificly mentioned otherwise, are licensed under this license.