Manjaro: ttyrec installieren

Freitag, 30. April, 2021

Ttyrec ist ein Open Source Werkzeug, mit dem man auf der Konsole alle Eingaben “mitschneiden” kann. Damit lassen sich Demos zur Handhabe von Installationen anfertigen oder ASCII Animationen aufzeichnen. Zur Wiedergabe gibt es ein ttyplay - oder für Webseiten auch einen Video Player, um eigene Online Dokumentationen zu ergänzen.

BTW: von ttyrec gibt es noch Portierungen in anderen Programmiersprachen, wie Python, Go, …

Aber zurück zu Manjaro. Es gibt mehrere AUR Pakete, um ttyrec auf Manjaro Linux builden zu lassen. Der Compilervorgang schlug bei mir aber jeweils fehl, weil ein man Verzeichnis bereits existiert:

Fehler: Vorgang konnte nicht abgeschlossen werden:
In Konflikt stehende Dateien:
- ovh-ttyrec-git: /usr/local/share/man existiert bereits im Dateisystem (gehört zu filesystem)

Die Lösung klingt etwas zu einfach … aber immerhin funktioniert es: man schaut einmal, was in diesem Verzeichnis ist und benennt es temporär um, um es dann anschliessend nach der Complilierung wiederherzustellen.

Gesagt - getan … und mit einem Underscore umbenannt:

axel@tux > sudo -i
root@tux# ls -l /usr/local/share/man
lrwxrwxrwx 1 root root 6 20. Jan 17:33 /usr/local/share/man -> ../man
root@tux# mv /usr/local/share/man /usr/local/share/man_

Ja, dann installieren / compilieren wir das nochmal … und starten pamac install ovh-ttyrec-git

root@tux# pamac install ovh-ttyrec-git
Warnung: ovh-ttyrec-git ist nur im AUR verfügbar
Vorbereitung...
Klone ovh-ttyrec-git Build-Dateien...
Running as unit: run-u161595.service
Finished with result: success
Main processes terminated with: code=exited/status=0
Service runtime: 309ms
Running as unit: run-u161597.service
Finished with result: success
Main processes terminated with: code=exited/status=0
Service runtime: 9ms
Überprüfe ovh-ttyrec-git Abhängigkeiten...
Abhängigkeiten werden aufgelöst...
Interne Konflikte werden überprüft...

Zu erstellen (1):
   ovh-ttyrec-git  v1.1.6.3.r0.gb8bdaab-1    AUR

Build-Dateien bearbeiten : [e]
Transaktion durchführen ? [e/j/N] j

Erstelle ovh-ttyrec-git...
Running as unit: run-u161604.service
Press ^] three times within 1s to disconnect TTY.
==> Making package: ovh-ttyrec-git v1.1.6.7.r1.ga13ca74-1 (Di 13 Apr 2021 17:24:30)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> Retrieving sources...
   -> Updating ovh-ttyrec git repo...
Fetching origin
==> Validating source files with sha256sums...
     ovh-ttyrec ... Skipped
==> Removing existing $srcdir/ directory...
==> Extracting sources...
   -> Creating working copy of ovh-ttyrec git repo...
Cloning into 'ovh-ttyrec'...
done.
Switched to a new branch 'makepkg'
==> Starting prepare()...
Looking for compiler... gcc
Checking if compiler can create executables... yes
Checking how to get pthread support... -pthread
Looking for libzstd... yes
Checking whether we can link zstd statically... no
Looking for isastream()... no
Looking for cfmakeraw()... yes
Looking for getpt()... yes
Looking for posix_openpt()... yes
Looking for grantpt()... yes
Looking for openpty()... yes (pty.h, libutil)
Checking for supported compiler options...
... OK -Wall
... OK -Wextra
... OK -pedantic
... OK -Wno-unused-result
... OK -Wbad-function-cast
... OK -Wmissing-declarations
... OK -Wmissing-prototypes
... OK -Wnested-externs
... OK -Wold-style-definition
... OK -Wstrict-prototypes
... OK -Wpointer-sign
... OK -Wmissing-parameter-type
... OK -Wold-style-declaration
... OK -Wl,--as-needed
... OK -Wno-unused-command-line-argument

You may run make now
==> Starting pkgver()...
==> Starting build()...

(...)

Vorgang erfolgreich abgeschlossen.

Das “erfolgreich abgeschlossen” klingt ja schonmal gut.

Jetzt muss ich nur noch das man Verzeichnis wiederherstellen. Durch das Complilieren entstand:

root@tux# ls -l /usr/local/share/man/man1/
insgesamt 12
-rw-r--r-- 1 root root  641 13. Apr 17:24 ttyplay.1.gz
-rw-r--r-- 1 root root 1751 13. Apr 17:24 ttyrec.1.gz
-rw-r--r-- 1 root root  308 13. Apr 17:24 ttytime.1.gz

In /usr/local/share/ sieht es nun so aus:

root@tux# ls -l
insgesamt 4
lrwxrwxrwx 1 root root    6 20. Jan 17:33 man -> ../man
drwxr-xr-x 3 root root 4096 13. Apr 17:24 man_ttyrec

Hier muss man nur das man_ttyrec/man1 in das man hineinschieben.

root@tux# mv man_ttyrec/man1/ ../man

Und das war’s dann.
Hurra, das Paket ist erfolgreich installiert… und ttyrec lässt sich starten.

weiterführende Links:

  1. Wikipedia: ttyrec (en)
  2. Arch-Linux AUR: Suche nach ttyrec (en)

Restic client auf 64 Bit Linux installieren

Mittwoch, 28. April, 2021

Restic [1] ist ein in Go geschriebenes Backup-Tool für die Kommandozeile … oder zum Skripten. Es besteht aus einem einzigen Binary und hat keinerlei Abhängigkeiten zu Libs, Paketen oder irgendwas. Es erzeugt dedulizierte Backups: initial wird ein Vollbackup gemacht und dann nie wieder - es braucht dann nur noch inkrementelle Backups. Restic gibt es für Windows/ Mac/ Linux und diverse Plattformen (BSD, Solaris, Mips, … - siehe Releases (dort etwas scrollen :-) [2]).

Das hat was.

Daheim werfe ich gerade einen Http-Server als Backup-Endpoint auf die Synology [3].

Auf Systeme am Institut habe ich grob 150 Linux-Systeme - mit altem und neuen Linux Varianten verschiedener Distributionen. Ich habe ein Bash Skript geschrieben, das mit wget das Binary des Restic Client holt, entpackt und ins /usr/bin legt. Wer es für ein anderes OS oder Architektur braucht, müsste den Suffix “_linux_amd64” ersetzen … oder aber auch dynamisch machen (mit

uname -a

könnte man hinkommen).

#!/usr/bin/env bash

# ------------------------------------------------------
# CONFIG
# ------------------------------------------------------
resticversion=0.12.0
doLink=0

installdir=/usr/bin
resticfile=restic_${resticversion}_linux_amd64
downloadfile=${resticfile}.bz2
downloadurl=https://github.com/restic/restic/releases/download/v${resticversion}/${downloadfile}

# ------------------------------------------------------
# MAIN
# ------------------------------------------------------
echo
echo "##### INSTALL RESTIC CLIENT into $installdir #####"
echo

echo ----- DOWNLOAD
if [ ! -f "${downloadfile}" ]; then
         wget -O "${downloadfile}.running" -S "${downloadurl}" 
                 && mv "${downloadfile}.running" "${downloadfile}"

else
         echo SKIP download
fi
echo

echo ----- UNCOMPRESS
bzip2 -d "${downloadfile}"
echo

echo ----- INSTALL
mv "${resticfile}" "${installdir}"
chmod 755 "${installdir}/${resticfile}"
rm -f "${installdir}/restic" 2>/dev/null
test $doLink -eq 0 || ln -s "${installdir}/${resticfile}" "${installdir}/restic"
test $doLink -eq 0 && mv "${installdir}/${resticfile}" "${installdir}/restic"

echo
echo ----- SELF-UPDATE
restic self-update
echo
echo ----- RESULT:
test $doLink -eq 0 || ls -l "${installdir}/${resticfile}" 
ls -l "${installdir}/restic"
echo
echo ----- CURRENT VERSION:
restic version
echo
echo ----- DONE

weiterführende Links:

  1. https://restic.net/ Homepage von Restic
  2. Github: Restic Releases
  3. Github: Skript zur Installation eines Restic Http Servers auf einer Synology