Skip to content

Instantly share code, notes, and snippets.

@ilyxa
Created August 29, 2021 20:37
Show Gist options
  • Save ilyxa/235437af337373d5691530b70a33f11f to your computer and use it in GitHub Desktop.
Save ilyxa/235437af337373d5691530b70a33f11f to your computer and use it in GitHub Desktop.
Modern mt-st-git variant for Archlinux
# Maintainer: Chris Severance aur.severach aATt spamgourmet dott com
# Contributor: Sam Stuewe <halosghost at archlinux dot info>
# Contributor: skottish <skottish97215 at gmail com>
set -u
_pkgname='mt-st'
pkgname="${_pkgname}-git"
pkgver=1.4.r10.gfbfd923
pkgrel=1
pkgdesc='Utilities for managing magnetic tape storage devices'
arch=('i686' 'x86_64')
url="https://github.com/iustin/${_pkgname}"
license=('GPLv2')
depends=('tar')
makedepends=('git')
provides=("${_pkgname}=${pkgver%.r*}")
conflicts=("${_pkgname}")
source=("${_pkgname}::${url//https/git}.git")
sha256sums=('SKIP')
pkgver() {
set -u
cd "${_pkgname}"
#printf '%s.r%s.g%s' "$(sed -ne 's:^#define VERSION "\(.*\)"$:\1:p' "mt.c")" "$(git rev-list --count HEAD)" "$(git describe --always )" # '
git describe --long | sed 's/\([^-]*-g\)/r\1/;s/-/./g;s/v//g'
set +u
}
_cp() {
mkdir -p "$(dirname $2)"
cp -a "$1" "$2"
}
prepare() {
set -u
cd "${_pkgname}"
sed -e 's:^#include <sys/types.h>$:#include <sys/sysmacros.h>\n&:g' -i 'mt.c'
sed -e 's:^SBINDIR=\ \$(DESTDIR)\/\$(EXEC_PREFIX)\/sbin$:SBINDIR=\ \$(DESTDIR)\/\$(EXEC_PREFIX)\/bin:g' -i Makefile
set +u
}
build() {
set -u
cd "${_pkgname}"
make
set +u
}
package() {
set -u
cd "${_pkgname}"
DEFTAPE="/dev/nst0" EXEC_PREFIX="/usr" DESTDIR="${pkgdir}" make install
_cp ../../stinit.service ${pkgdir}/usr/lib/systemd/system/stinit.service
_cp ../../stinit.def ${pkgdir}/etc/stinit.def
set +u
}
set +u
# vim:set ts=2 sw=2 et:
# HP Ultrium 6-SCSI
manufacturer=HP model= "Ultrium 6-SCSI" {
scsi2logical=1
can-bsr=1
auto-lock=0
two-fms=0
drive-buffering=1
buffer-writes
read-ahead=1
async-writes=1
can-partitions=0
fast-eom=1
mode1 blocksize=0 density=0x58 compression=1
mode2 compression=1
mode3 compression=1
mode4 compression=1
}
[Unit]
Description=Initialize SCSI Tape Drives
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/sbin/stinit -f /etc/stinit.def
[Install]
WantedBy=multi-user.target
@ReeseWang
Copy link

You could use install -D instead of the _cp function you wrote.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment