Install Haroopad (markdown editor)

Thought I should share an install I made, if anyone’s interested - but didn’t know where to put it (no obvious category). So, in case “Off-Topic” is wrong - please move it.

 

There are no Markdown editors when searching with dnf. Then there are a few ones one could install via custom RPM’s which includes adding or build other dependencies on top of that. I looked at ”Remarkable”, which I like and have used before, but it needed too much work. So, I figured - let’s install Haroopad - which I have on my Mac, and have used in Linux before. It’s just, they only have deb-files for Linux. But, it’s nice to have/use the same program on both computers.

One could install alien and maybe make it an rpm, but I went manually on this one.

Here’s how I did it - in case someone else want/need this.


Download the source/tarball:.

The difference between their deb-package and “Linux Binary” is just it’s not a deb-file. Still, the content is the same as in a deb-package. Control, Data, etc.


Unpack the tarball and cd into it, and extract the control and data archives.

$ cd /path/to/haroopad-v0.13.1-x64/
$ tar -xvf {control,data}.tar.gz

Now, in the control folder there’s a post install script. Copy that one to the package root, and that one will be the install script. It just needs all the install parts. :slight_smile:

$ cp control/postinst install.sh

# postinst look like this
$ cat install.sh
#!/bin/bash
paths=(
  "/lib/x86_64-linux-gnu/libudev.so.1" # Ubuntu, Xubuntu, Mint
  "/usr/lib64/libudev.so.1" # SUSE, Fedora
  "/usr/lib/libudev.so.1" # Arch, Fedora 32bit
  "/lib/i386-linux-gnu/libudev.so.1" # Ubuntu 32bit
)
for i in "${paths[@]}"
do
  res=$(echo $i | sed "s/so.1/so.0/g")
  if [ -f $i ]
  then
    ln -sf "$i" "$res"
    break
  fi
done

 

Here’s my install.sh, with all the install/copy parts added. The script is kind of self-explanatory. And I added some (commented) lines at the end to uninstall it.

If you just copy the text/script from here - don’t forget to run chmod 755 on it.

Note: In the install script, it also installs the dependency GConf2, via dnf

File: install.sh
#!/bin/bash

# Install with sudo
if [[ $EUID -ne 0 ]]; then
    echo "$0 is not running as root. Try using sudo."
    exit 2
fi


paths=(
  "/lib/x86_64-linux-gnu/libudev.so.1" # Ubuntu, Xubuntu, Mint
  "/usr/lib64/libudev.so.1" # SUSE, Fedora
  "/usr/lib/libudev.so.1" # Arch, Fedora 32bit
  "/lib/i386-linux-gnu/libudev.so.1" # Ubuntu 32bit
)
for i in "${paths[@]}"
do
  res=$(echo $i | sed "s/so.1/so.0/g")
  if [ -f $i ]
  then
    ln -sf "$i" "$res"
    break
  fi
done


# Install dependency
echo -e '\v:: Installing Gconf2...\n'
dnf in -y GConf2

# Install the content parts in data (usr) to each location
_name='haroopad';

# Install the bin wrapper
install -v -m755 -o0 -g0 usr/bin/${_name} /usr/bin/

# Install the desktop file
install -v -m644 -o0 -g0 \
    usr/share/applications/Haroopad.desktop \
    /usr/share/applications/

# Add Haroopad to the default list
echo 'text/x-markdown=Haroopad.desktop' | tee -a /usr/share/applications/mimeapps.list

# Put the doc files in its own folder
install -vd -m755 -o0 -g0 /usr/share/doc/${_name}
install -v -m644 -o0 -g0 \
    usr/share/doc/{changelog,copyright} \
    /usr/share/doc/${_name}

# Install the haroopad folder
# since its a mix of files and folders - I use rsync here
rsync -av --no-o --no-g usr/share/${_name} /usr/share/

# icons
for s in 16 22 24 32 48 64 128; do
    install -v -m644 -o0 -g0 \
        usr/share/icons/hicolor/${s}x${s}/apps/${_name}.png \
        /usr/share/icons/hicolor/${s}x${s}/apps/;
done


# Uninstall would be something like
#   rm -v /usr/bin/haroopad
#
#   rm -v /usr/share/applications/Haroopad.desktop
#     + edit the file mimeapps.list and remove the Haroopad line
#
#   rm -rv /usr/share/haroopad
#   rm -rv /usr/share/doc/haroopad
#
#   shopt -s globstar
#   cd /usr/share/icons/hicolor && rm -v ./**/haroopad.png
#
#   rm -rv ~/.local/share/applications/Haroopad.desktop
#   rm -rv ~/.config/Haroopad
#
# And uninstall GConf2, if not needed.
#   dnf rm -y GConf2
#

 

After that, I ccpied the Haroopad.desktop file to .local/share …, to fix the icon and get some locales. :slight_smile:

$ cd ~/.local/share/applications/
$ cp /usr/share/applicaions/Haroopad.desktop .

And updated the file to this:

[Desktop Entry]
Version=1.0
Type=Application
Name=Haroopad
Name[sv]=Haroopad
Comment=The Next Document processor based on Markdown
Comment[sv]=Next Document-processorn baserad på Markdown
Terminal=false
StartupNotify=true
Encoding=UTF-8
Categories=Development;Office;XFCE;GTK;GNOME;
Exec=haroopad
Icon=/usr/share/icons/hicolor/128x128/apps/haroopad.png

 

Well, the program works as expected, and looks like it usually does.

Only thing that’s a bit annoying with Haroopad, is efter 5-10 sec, a “Donate” message popup at the bottom. Easy to close, and I guess it comes with the pricetag.

But, it’s a really good Markdown editor. Easy to work with, and you can export the file to HTML or a PDF. And it can do GitHub-flavored markdown, and Footnotes.


 

Hope you’ll like it.

· Eric