1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-11-21 00:25:50 +00:00

net-mgmt/triton-guesttools: create port

FreeBSD guest tools to enabled compatability with SmartOS and Triton.

WWW: https://github.com/joyent/freebsd-kvm-image-builder/tree/master/triton-freebsd-guesttools
This commit is contained in:
Steve Wills 2017-11-15 22:43:20 +00:00
parent 24914bb2ca
commit bdb90155bb
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=454294
17 changed files with 243 additions and 0 deletions

View File

@ -361,6 +361,7 @@
SUBDIR += telegraf
SUBDIR += tornova
SUBDIR += torrus
SUBDIR += triton-guesttools
SUBDIR += unbound_exporter
SUBDIR += unifi5
SUBDIR += victorops-nagios

View File

@ -0,0 +1,47 @@
# $FreeBSD$
PORTNAME= triton-guesttools
PORTVERSION= 0.0.0.0s2017111501
CATEGORIES= net-mgmt
MAINTAINER= swills@FreeBSD.org
COMMENT= FreeBSD guest tools for use with SmartOS
RUN_DEPENDS= bash:shells/bash \
mdata-client>0:net-mgmt/mdata-client
USES= shebangfix
USE_GITHUB= yes
GH_ACCOUNT= joyent
GH_TAGNAME= 34c19b0
GH_PROJECT= freebsd-kvm-image-builder
WRKSRC_SUBDIR= triton-freebsd-guesttools
SHEBANG_FILES= ${WRKSRC}/lib/smartdc/add-network-interface \
${WRKSRC}/lib/smartdc/common.lib \
${WRKSRC}/lib/smartdc/firstboot \
${WRKSRC}/lib/smartdc/format-secondary-disk \
${WRKSRC}/lib/smartdc/get-user-data \
${WRKSRC}/lib/smartdc/run-operator-script \
${WRKSRC}/lib/smartdc/run-user-script \
${WRKSRC}/lib/smartdc/set-hostname \
${WRKSRC}/lib/smartdc/set-root-authorized-keys \
${WRKSRC}/lib/smartdc/set-rootpassword \
${WRKSRC}/lib/smartdc/triton
post-extract:
@${RM} -r ${WRKSRC}/usr
post-patch:
@${REINPLACE_CMD} -e 's,%%PREFIX%%,${PREFIX},' ${WRKSRC}/etc/rc.d/triton
do-build:
@${REINPLACE_CMD} -e 's,%%PREFIX%%,${PREFIX},' ${WRKSRC}/etc/rc.d/triton ${WRKSRC}/lib/smartdc/*
do-install:
${MKDIR} ${STAGEDIR}${PREFIX}/lib ${STAGEDIR}${PREFIX}/etc/rc.d
${INSTALL_SCRIPT} ${WRKSRC}/etc/rc.d/triton ${STAGEDIR}${PREFIX}/etc/rc.d
( cd ${WRKSRC}/lib/ && \
${COPYTREE_BIN} smartdc ${STAGEDIR}${PREFIX}/lib )
.include <bsd.port.mk>

View File

@ -0,0 +1,3 @@
TIMESTAMP = 1510774567
SHA256 (joyent-freebsd-kvm-image-builder-0.0.0.0s2017111501-34c19b0_GH0.tar.gz) = b901079b40c14101f7568b99d838324f2917a26105f0046b011d19cf71893b0c
SIZE (joyent-freebsd-kvm-image-builder-0.0.0.0s2017111501-34c19b0_GH0.tar.gz) = 89163

View File

@ -0,0 +1,22 @@
--- etc/rc.d/triton.orig 2017-05-22 19:41:07 UTC
+++ etc/rc.d/triton
@@ -7,16 +7,18 @@
. /etc/rc.subr
name="triton"
+rcvar=triton_enable
start_cmd="${name}_start"
stop_cmd=":"
load_rc_config $name
+: ${triton_enable:=NO}
triton_start()
{
- /lib/smartdc/triton
+ %%PREFIX%%/lib/smartdc/triton
}
run_rc_command "$1"

View File

@ -0,0 +1,11 @@
--- lib/smartdc/add-network-interface.orig 2017-05-22 19:41:07 UTC
+++ lib/smartdc/add-network-interface
@@ -4,7 +4,7 @@
# This script checks new network interfaces for and enables via DHCP at boot.
# load common functions and vars
-. /lib/smartdc/common.lib
+. %%PREFIX%%/lib/smartdc/common.lib
nic_added=n

View File

@ -0,0 +1,21 @@
--- lib/smartdc/common.lib.orig 2017-05-22 19:41:07 UTC
+++ lib/smartdc/common.lib
@@ -3,15 +3,15 @@
#
# Copyright (c) 2016 Joyent Inc., All rights reserved.
#
-# Common variables used by scripts in /lib/smartdc
+# Common variables used by scripts in %%PREFIX%%/lib/smartdc
# location of binaries that functions use
LOGGER=/usr/bin/logger
-MDATA_GET='/usr/sbin/mdata-get'
+MDATA_GET='%%PREFIX%%/sbin/mdata-get'
set -o xtrace
-# Common functions used by scripts /lib/smartdc
+# Common functions used by scripts %%PREFIX%%/lib/smartdc
lib_triton_fatal() {
echo "(fatal) - $0 - $@"

View File

@ -0,0 +1,23 @@
--- lib/smartdc/firstboot.orig 2017-05-22 19:41:07 UTC
+++ lib/smartdc/firstboot
@@ -4,16 +4,16 @@
# For scripts that should be run on first boot only
# load common functions and vars
-. /lib/smartdc/common.lib
+. %%PREFIX%%/lib/smartdc/common.lib
# Set root password if root_pw is set in the image manifest
-(/lib/smartdc/set-rootpassword)
+(%%PREFIX%%/lib/smartdc/set-rootpassword)
# Format disk
-(/lib/smartdc/format-secondary-disk)
+(%%PREFIX%%/lib/smartdc/format-secondary-disk)
# Disable firstboot once all scripts are run
lib_triton_info "Disabling firstboot"
-touch /lib/smartdc/.firstboot-complete-do-not-delete
+touch %%PREFIX%%/lib/smartdc/.firstboot-complete-do-not-delete
exit 0

View File

@ -0,0 +1,11 @@
--- lib/smartdc/format-secondary-disk.orig 2017-05-22 19:41:07 UTC
+++ lib/smartdc/format-secondary-disk
@@ -10,7 +10,7 @@
# By default we provision the whole disk as one partition
# load common functions and vars
-. /lib/smartdc/common.lib
+. %%PREFIX%%/lib/smartdc/common.lib
DATADISKDEVICE='vtbd1'
GPART=/sbin/gpart

View File

@ -0,0 +1,11 @@
--- lib/smartdc/get-user-data.orig 2017-05-22 19:41:07 UTC
+++ lib/smartdc/get-user-data
@@ -7,7 +7,7 @@
# before script "run-user-script"
# load common functions and vars
-. /lib/smartdc/common.lib
+. %%PREFIX%%/lib/smartdc/common.lib
lib_triton_info "Retrieving metadata user-data"
$MDATA_GET user-data >/var/tmp/mdata-user-data.new

View File

@ -0,0 +1,11 @@
--- lib/smartdc/run-operator-script.orig 2017-05-22 19:41:07 UTC
+++ lib/smartdc/run-operator-script
@@ -3,7 +3,7 @@
# Copyright (c) 2016 Joyent Inc., All rights reserved.
#
-. /lib/smartdc/common.lib
+. %%PREFIX%%/lib/smartdc/common.lib
lib_triton_info "Retrieving metadata operator-script..."
$MDATA_GET sdc:operator-script >/var/tmp/mdata-operator-script.new

View File

@ -0,0 +1,11 @@
--- lib/smartdc/run-user-script.orig 2017-05-22 19:41:07 UTC
+++ lib/smartdc/run-user-script
@@ -10,7 +10,7 @@
# This script is executed on each system boot
# load common functions and vars
-. /lib/smartdc/common.lib
+. %%PREFIX%%/lib/smartdc/common.lib
lib_triton_info "Retrieving metadata user-script..."
$MDATA_GET user-script >/var/tmp/mdata-user-script.new

View File

@ -0,0 +1,11 @@
--- lib/smartdc/set-hostname.orig 2017-05-22 19:41:07 UTC
+++ lib/smartdc/set-hostname
@@ -4,7 +4,7 @@
# Set the hostname of the VM if it's not already configured by the user.
# load common functions and vars
-. /lib/smartdc/common.lib
+. %%PREFIX%%/lib/smartdc/common.lib
grep hostname= /etc/rc.conf &>/dev/null
if [[ $? -ne 0 ]]; then

View File

@ -0,0 +1,11 @@
--- lib/smartdc/set-root-authorized-keys.orig 2017-05-22 19:41:07 UTC
+++ lib/smartdc/set-root-authorized-keys
@@ -7,7 +7,7 @@
# By default this script is called on each boot
# load common functions and vars
-. /lib/smartdc/common.lib
+. %%PREFIX%%/lib/smartdc/common.lib
if [[ ! -f /root/.ssh/authorized_keys ]]; then
authorized_keys=$($MDATA_GET root_authorized_keys | awk '{ sub(/(ssh-rsa )/,"\n&"); print }' | awk '{ sub(/(ssh-dss )/,"\n&"); print }' 2>>/dev/console)

View File

@ -0,0 +1,11 @@
--- lib/smartdc/set-rootpassword.orig 2017-05-22 19:41:07 UTC
+++ lib/smartdc/set-rootpassword
@@ -12,7 +12,7 @@
# /etc/master.passwd to ensure a root password is not being overwritten.
# load common functions and vars
-. /lib/smartdc/common.lib
+. %%PREFIX%%/lib/smartdc/common.lib
# Check /etc/master.passwd. If root pass is set, exit so we don't clobber an
# already set password.

View File

@ -0,0 +1,23 @@
--- lib/smartdc/triton.orig 2017-05-22 19:41:07 UTC
+++ lib/smartdc/triton
@@ -13,12 +13,12 @@ export PS4='[\D{%FT%TZ}] ${BASH_SOURCE}:${LINENO}: ${F
export BASH_XTRACEFD=4
set -o xtrace
-(/lib/smartdc/add-network-interface)
-(/lib/smartdc/set-hostname)
-(/lib/smartdc/set-root-authorized-keys)
-if [ ! -f /lib/smartdc/.firstboot-complete-do-not-delete ] ; then
- (/lib/smartdc/firstboot)
+(%%PREFIX%%/lib/smartdc/add-network-interface)
+(%%PREFIX%%/lib/smartdc/set-hostname)
+(%%PREFIX%%/lib/smartdc/set-root-authorized-keys)
+if [ ! -f %%PREFIX%%/lib/smartdc/.firstboot-complete-do-not-delete ] ; then
+ (%%PREFIX%%/lib/smartdc/firstboot)
fi
-(/lib/smartdc/run-operator-script)
-(/lib/smartdc/get-user-data)
-(/lib/smartdc/run-user-script)
+(%%PREFIX%%/lib/smartdc/run-operator-script)
+(%%PREFIX%%/lib/smartdc/get-user-data)
+(%%PREFIX%%/lib/smartdc/run-user-script)

View File

@ -0,0 +1,3 @@
FreeBSD guest tools to enabled compatability with SmartOS and Triton.
WWW: https://github.com/joyent/freebsd-kvm-image-builder/tree/master/triton-freebsd-guesttools

View File

@ -0,0 +1,12 @@
etc/rc.d/triton
lib/smartdc/add-network-interface
lib/smartdc/common.lib
lib/smartdc/firstboot
lib/smartdc/format-secondary-disk
lib/smartdc/get-user-data
lib/smartdc/run-operator-script
lib/smartdc/run-user-script
lib/smartdc/set-hostname
lib/smartdc/set-root-authorized-keys
lib/smartdc/set-rootpassword
lib/smartdc/triton