Gentoo VAL ebuilds

Backup agent for Linux servers and workstations on-premises or in the public cloud

Gentoo VAL ebuilds

Veeam Logoby mgenet » Sun May 28, 2017 11:57 pm

Hi

Have just installed VAL on Gentoo, and in the process have created ebuilds for processing them.
These have only been tested on my working versions of Gentoo (64bit) across kernels 4.9.6 and 4.9.16.
They make use of the debian archives for version 1.0.0.944.

In order to use them it's best to create a custom local repository , (https://wiki.gentoo.org/wiki/Custom_repository).
I used app-backup as the "top folder" with two sub-directories veeam (for the binaries) and veeamsnap for the kernel module.

veeam-1.0.0.944.ebuild
Code: Select all
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

EAPI="6"

# Only fetch the file from Veeam
RESTRICT="mirror"

inherit eutils unpacker

MY_PN=${PN}
MY_PVR=${PVR}
DESCRIPTION="Veeam backup suite for Linux"
HOMEPAGE="https://www.veeam.com"
SRC_URI="
x86?   ( http://repository.veeam.com/backup/linux/agent/dpkg/debian/public/pool/veeam/v/veeam/${MY_PN}_${MY_PVR}_i386.deb )
amd64? ( http://repository.veeam.com/backup/linux/agent/dpkg/debian/public/pool/veeam/v/veeam/${MY_PN}_${MY_PVR}_amd64.deb )"

LICENSE="all-rights-reserved"
SLOT="0"
KEYWORDS="~x86 ~amd64"
IUSE=""

RDEPEND="
app-backup/veeamsnap
sys-apps/acl
sys-fs/fuse
~sys-libs/ncurses-5.9[tinfo]
"

# As it's packed into a lower directory specify the source
S=${WORKDIR}

# As this is a prebuild binary no need to compile
QA_PREBUILT="/opt/*"

src_unpack() {
    unpack_deb ${A}
}

src_prepare() {
default
# Remove symbolic link for veeam in bin
rm -f usr/bin/veeam
}

src_install() {
# At this time install all binaries into /opt/veeam
# and as we move multiple directories use doins (not doexec)
insinto /opt/${MY_PN}
doins -r usr/.
# Fix permissions (as we aren't using doexec)
fperms +x /opt/${MY_PN}/bin/${MY_PN}config
fperms +x /opt/${MY_PN}/sbin/${MY_PN}agent
fperms +x /opt/${MY_PN}/sbin/${MY_PN}jobman
fperms +x /opt/${MY_PN}/sbin/${MY_PN}service
# Set symbolic link back to /usr/...
dosym /opt/${MY_PN}/bin/${MY_PN}config /usr/bin/${MY_PN}
dosym /opt/${MY_PN}/sbin/${MY_PN}service /usr/sbin/${MY_PN}service
dosym /opt/${MY_PN}/sbin/${MY_PN}agent /usr/sbin/${MY_PN}agent
dosym /opt/${MY_PN}/sbin/${MY_PN}jobman /usr/sbin/${MY_PN}jobman

# Install veeam ini directory to etc
insinto /etc
doins -r etc/veeam

# Install gentoo specific init.d and conf.d files if they exist
if [[ -e "${FILESDIR}"/veeamservice.initd && -e "${FILESDIR}"/veeamservice.confd ]]; then
newinitd "${FILESDIR}"/veeamservice.initd veeamservice
newconfd "${FILESDIR}"/veeamservice.confd veeamservice
else
# Install veeamservice init.d script to /opt/${MY_PN}/share/etc if not
insinto /opt/${MY_PN}/share/etc
doins -r etc/init.d
fi
}

pkg_postinst() {
if [[ -e /opt/"${MY_PN}"/share/etc/init.d/veeamservice ]]; then
einfo "The default init.d script from the Veeam package has"
einfo "been installed into /opt/${MY_PN}/share/etc/init.d/veeamservice"
einfo "for reference."
einfo "You can use:"
einfo "\t/usr/sbin/veeamservice -d"
einfo "to start the service."
fi
}


and
veeamsnap-1.0.0.944.ebuild
Code: Select all
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

EAPI="6"

# Only fetch the file from Veeam
RESTRICT="mirror"

inherit eutils linux-mod unpacker

MY_PN=${PN}
MY_PVR=${PVR}
DESCRIPTION="Veeam kernel module for Veeam backup suite"
HOMEPAGE="https://www.veeam.com"
SRC_URI="http://repository.veeam.com/backup/linux/agent/dpkg/debian/public/pool/veeam/v/veeamsnap/${MY_PN}_${MY_PVR}_all.deb"

LICENSE="all-rights-reserved"
SLOT="0"
KEYWORDS="~x86 ~amd64"
IUSE=""

# As it's packed into a lower directory specify the source
S=${WORKDIR}/usr/src/${MY_PN}-${MY_PVR}
MODULE_NAMES="veeamsnap(extra:${S})"
BUILD_TARGETS="all"

src_unpack() {
        unpack_deb ${A}
}

pkg_setup() {
# Any specific config required for veeam
CONFIG_CHECK="~FUSE_FS"
check_extra_config
BUILD_PARAMS="KDIR=${KV_OUT_DIR}"
linux-mod_pkg_setup
}

src_prepare() {
default

# Avoid "make jobserver unavailable" warning
cd ${S}
sed -e 's:\tmake:\t+make:g' -i Makefile || die "sed failed"
}

src_compile() {
KERNEL_DIR="/lib/modules/${KV_FULL}/build" linux-mod_src_compile
}

src_install() {
linux-mod_src_install
}

pkg_postinst() {
linux-mod_pkg_postinst
}


Some notes:
For the binary I install under /opt with symbolic links back to the /usr for the binaries.
I don't install the init.d script as it needed a few changes to make it work with Gentoo, instead I created a new init.d script and conf.d config file
which gets installed if there are found in the files folder under veeam.

init.d script
veeamservice.initd
Code: Select all
#!/sbin/openrc-run
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

extra_commands="checkconfig"
extra_started_commands="reload"

depend() {
need localmount net logger
use dns
after bootmisc
}

checkconfig() {
if ! lsmod | grep "$VEEAMSERVICE_MODULE" >/dev/null; then
if ! modprobe $VEEAMSERVICE_MODULE ; then
eerror "$VEEAMSERVICE_MODULE support is not available" \
"in this kernel"
return 1
fi
fi
}

start() {
checkconfig || return 1

ebegin "Starting veeamservice"

start-stop-daemon --start --quiet --exec "${VEEAMSERVICE_EXEC}" \
--pidfile "${VEEAMSERVICE_PIDFILE}" -- \
${VEEAMSERVICE_OPTS}
eend $?
}

stop() {
if [ "${RC_CMD}" = "restart" ] ; then
checkconfig || return 1
fi

ebegin "Stopping veeamservice"
start-stop-daemon --stop --quiet --pidfile "${VEEAMSERVICE_PIDFILE}"
eend $?
}

reload() {
start-stop-daemon --stop --signal HUP --quiet --pidfile "${VEEAMSERVICE_PIDFILE}"
eend $?
}


and conf.d file
veeamservice.confd
Code: Select all
# /etc/conf.d/veeamservice: config file for /etc/init.d/veeamservice

# this is the veeamservice executable
VEEAMSERVICE_EXEC="/usr/sbin/veeamservice"

# this is where veeamservice will store its pid file
VEEAMSERVICE_PIDFILE="/var/run/veeamservice.pid"

# this is the kernel module of veeamservice
VEEAMSERVICE_MODULE="veeamsnap"

# Additional options
VEEAMSERVICE_OPTS="--daemonize --pidfile=$VEEAMSERVICE_PIDFILE"


Feel free to modify as required.

Cheers
--Mark
mgenet
Lurker
 
Posts: 2
Liked: never
Joined: Thu May 25, 2017 8:49 pm
Full Name: Mark Genet

Re: Gentoo VAL ebuilds

Veeam Logoby vmniels » Mon May 29, 2017 1:03 pm

Hi Mark,

Thanks for sharing. We just released update 1 today which brings the version to 1.0.1.364. These are mostly bugfixes so the process will be the same.
VCP-DCV
Veeam Certified Engineer
http://foonet.be
vmniels
Veeam Software
 
Posts: 1504
Liked: 325 times
Joined: Mon Jul 15, 2013 11:09 am
Full Name: Niels Engelen

Re: Gentoo VAL ebuilds

Veeam Logoby mgenet » Mon May 29, 2017 8:02 pm

Hi

I also note that the group veeam needs to be created in order to run the service.
Here is a patch that can be applied to the version bumped veeam ebiuld to generate the group.

Code: Select all
--- veeam-1.0.0.944.ebuild2017-05-30 07:18:42.123213062 +1200
+++ veeam-1.0.1.364.ebuild2017-05-30 07:52:54.815229499 +1200
@@ -6,7 +6,7 @@
 # Only fetch the file from Veeam
 RESTRICT="mirror"
 
-inherit eutils unpacker
+inherit eutils unpacker user
 
 MY_PN=${PN}
 MY_PVR=${PVR}
@@ -34,6 +34,11 @@
 # As this is a prebuild binary no need to compile
 QA_PREBUILT="/opt/*"
 
+pkg_setup() {
+# Create new veeam group
+enewgroup veeam
+}
+
 src_unpack() {
 unpack_deb ${A}
 }


Cheers
--Mark
mgenet
Lurker
 
Posts: 2
Liked: never
Joined: Thu May 25, 2017 8:49 pm
Full Name: Mark Genet


Return to Veeam Agent for Linux



Who is online

Users browsing this forum: No registered users and 7 guests