HTTPS SSH

FHEM Patches

Purpose of this project

From time to time, I skimm through the FHEM documentation and encounter typos, misspellings, misformats etc. pp. and have the urge to fix them. This is the place where I gather my patches.

Usage

Very simple, though. For every file I did a patch, I created a folder with subsequent patches in it. So the file

docs/commandref_frame_DE.html

becomes

docs/commandref_frame_DE.html/<patch>

How to create a patch

By script

I added create-fhem-patches to this repository. create-fhem-patches creates patches based on the FHEM Github Mirror.

Invoke create-fhem-patches -h to get a manual.

Manually

It mostly depends on how you got FHEM. If using Subversion, svn diff <file> is a proper start, as well as git diff <file> for Git. Just consult the manuals for

  • svn
  • git
  • diff

(You probably noticed that i'm not very much a fan of the manual thing. Guess you are right.)

Example script

I.e. this little script will patch every affected file with it's subseqient patches:

Prerequisits

  • Replace _FHEM_DIR with your FHEM installation directory
  • Replace _PATCHES_DIR with the path to this files

Source

#!/usr/bin/env bash

# replace this with the path to this files
_PATCHES_DIR="$(realpath $(dirname $0)/../source/patches)"

# replace this with your FHEM installation directory
_FHEM_DIR="/opt/fhem"

# path to your patch binary, adding some flags
_PATCH_BIN="patch -r /dev/null -N"

echo "Source dir: ${_PATCHES_DIR}"

for patch_file in $(find "${_PATCHES_DIR}" -iname '*.patch' -type f -printf "%P\n")
do
    source="${_PATCHES_DIR}/$patch_file"
    target="$(dirname ${_FHEM_DIR}/$patch_file)"

    echo "Applying patch '${source}' to file '${target}'"
    ${_PATCH_BIN} ${target} ${source};

done

LICENSE

This is distributed under the GNU LGPLv3.

See also