opsi/net-misc/opsi-linux-bootimage/opsi-linux-bootimage-20161221.ebuild

62 lines
1.6 KiB
Bash
Raw Permalink Normal View History

# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
EAPI=4
inherit eutils rpm
RPM_VER="1.1"
KVER="compile"
OPSI="opsi40"
SUSE="openSUSE_13.2"
DESCRIPTION="opsi linux bootimage"
HOMEPAGE="http://opsi.org/"
SRC_URI="http://download.opensuse.org/repositories/home:/uibmz:/opsi:/${OPSI}/${SUSE}/src/${P}-${RPM_VER}.src.rpm"
LICENSE="GPL-2"
IUSE=""
KEYWORDS="~amd64 ~arm ~x86"
RDEPEND="net-misc/opsi-utils"
DEPEND="${RDEPEND}"
RESTRICT=""
SLOT="0"
src_compile() {
einfo "Nothing to compile"
}
src_install() {
insinto /tftpboot/linux
doins syslinux/chain.c32 syslinux/menu.c32 syslinux/pxelinux.0
newins miniroot.bz2 miniroot-${PV}.bz2
newins vmlinuz vmlinuz-${KVER}
dosym miniroot-${PV}.bz2 tftpboot/linux/miniroot.bz2
dosym vmlinuz-${KVER} tftpboot/linux/install
insinto /tftpboot/linux/pxelinux.cfg
doins default.menu default.nomenu install
}
pkg_postinst() {
fileadmingroup=$(grep "fileadmingroup" /etc/opsi/opsi.conf | cut -d "=" -f 2 | sed 's/ //g')
chown -R opsiconfd:$fileadmingroup /tftpboot/linux || true
chmod 2775 /tftpboot/linux
chmod 2775 /tftpboot/linux/pxelinux.cfg
find /tftpboot/linux -type f -exec chmod 664 {} \;
if [ ! -e /tftpboot/linux/pxelinux.cfg/default ]; then
cd /tftpboot/linux/pxelinux.cfg
ln -s default.menu default
cd - >/dev/null
fi
serviceentry=$(opsi-admin --no-depot -Sd method config_getObjects '[]' '{"id":"clientconfig.configserver.url"}' | grep defaultValues | cut -d "'" -f2)
if [ "$serviceentry" != "" ]; then
sed -i "s,append.*$,& service=$serviceentry,g" /tmp/default.menu
fi
}