ports/174769: emulators/vboxtool make PREFIX safe

Pawel Pekala pawel at FreeBSD.org
Fri Dec 28 15:00:01 UTC 2012


>Number:         174769
>Category:       ports
>Synopsis:       emulators/vboxtool make PREFIX safe
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Fri Dec 28 15:00:00 UTC 2012
>Closed-Date:
>Last-Modified:
>Originator:     Pawel Pekala
>Release:        10.0-CURRENT
>Organization:
>Environment:
FreeBSD blaviken.slowicza.org 10.0-CURRENT FreeBSD 10.0-CURRENT #2: Fri Nov 30 20:03:01 CET 2012     corn at blaviken.slowicza.org:/usr/obj/amd64.amd64/usr/src/sys/BLAVIKEN64  amd64

>Description:
This patch makes sure port is working properly when installed to
PREFIX != /usr/local. Also make it more clever about finding bash
by using env(1) utility. Changes are simple so I thought it's
better to use REINPLACE_CMD and save few inodes in process.
>How-To-Repeat:

>Fix:


Patch attached with submission follows:

diff -urN /usr/ports/emulators/vboxtool/Makefile emulators/vboxtool/Makefile
--- /usr/ports/emulators/vboxtool/Makefile	2012-11-17 06:57:23.000000000 +0100
+++ emulators/vboxtool/Makefile	2012-12-17 14:56:18.000000000 +0100
@@ -7,6 +7,7 @@
 
 PORTNAME=	vboxtool
 PORTVERSION=	0.5
+PORTREVISION=	1
 CATEGORIES=	emulators
 MASTER_SITES=	SF
 
@@ -27,6 +28,12 @@
 
 SAMPLESDIR=	${PREFIX}/share/${PORTNAME}
 
+post-patch:
+	@${REINPLACE_CMD} -e 's|!/bin/bash|!/usr/bin/env bash|' \
+		-e 's|/etc/|${PREFIX}&|g' \
+		${WRKSRC}/script/vboxtool \
+		${WRKSRC}/script/vboxtoolinit
+
 do-install:
 	@if  [ ! -f ${PREFIX}/etc/${PORTNAME} ]; then \
 		${MKDIR}  	${PREFIX}/etc/${PORTNAME};\
diff -urN /usr/ports/emulators/vboxtool/files/patch-script-vboxtool emulators/vboxtool/files/patch-script-vboxtool
--- /usr/ports/emulators/vboxtool/files/patch-script-vboxtool	2012-07-13 11:17:01.000000000 +0200
+++ emulators/vboxtool/files/patch-script-vboxtool	1970-01-01 01:00:00.000000000 +0100
@@ -1,37 +0,0 @@
---- script/vboxtool.org	2012-04-29 21:59:59.000000000 +0200
-+++ script/vboxtool	2012-06-16 01:26:32.000000000 +0200
-@@ -1,4 +1,4 @@
--#!/bin/bash
-+#!/usr/local/bin/bash
- #
- #  vboxtool: Utility to retrieve status and control VirtualBox sessions
- #
-@@ -55,7 +55,7 @@
-   echo "  --version|version Version info."
-   echo "  --help|help       This help."
-   echo ""
--  echo "*Configuration. vboxtool depends on two config files, located in /etc/vboxtool."
-+  echo "*Configuration. vboxtool depends on two config files, located in /usr/local/etc/vboxtool."
-   echo ""
-   echo "Configuration file $machines_conf:"
-   echo "- each line in this file is a separate machine" 
-@@ -84,7 +84,7 @@
-   echo ""  
-   echo "*Start at boot, save on halt. VBoxTool is capable for autostart sessions at"
-   echo "boot time and autosave sessions when host is stopped. This depends on "
--  echo "/etc/vboxtool/vboxtool.conf. In here, the variable vbox_user must be filled:"
-+  echo "/usr/local/etc/vboxtool/vboxtool.conf. In here, the variable vbox_user must be filled:"
-   echo "vbox_user='<user name>'" 
-   echo "Note the quotes. Fill for <user name> the name of the user under which"
-   echo "sessions are installed/running."  
-@@ -545,8 +545,8 @@
- 
- # Some constants
- version='0.5'
--machines_conf='/etc/vboxtool/machines.conf'
--vboxtool_conf='/etc/vboxtool/vboxtool.conf'
-+machines_conf='/usr/local/etc/vboxtool/machines.conf'
-+vboxtool_conf='/usr/local/etc/vboxtool/vboxtool.conf'
- vbox_folder="$HOME/.VirtualBox"   
- log_file="$vbox_folder/vboxtool.log"
- 
diff -urN /usr/ports/emulators/vboxtool/files/patch-script-vboxtoolinit emulators/vboxtool/files/patch-script-vboxtoolinit
--- /usr/ports/emulators/vboxtool/files/patch-script-vboxtoolinit	2012-07-13 11:17:01.000000000 +0200
+++ emulators/vboxtool/files/patch-script-vboxtoolinit	1970-01-01 01:00:00.000000000 +0100
@@ -1,39 +0,0 @@
---- script/vboxtoolinit.org	2012-04-29 21:59:59.000000000 +0200
-+++ script/vboxtoolinit	2012-06-16 01:26:32.000000000 +0200
-@@ -1,14 +1,14 @@
--#!/bin/bash
-+#!/usr/local/bin/bash
- #
- #  vboxtoolinit: Frontend for vboxtool for auto start sessions when booting and save 
- #                sessions when host is stopped
- #
--#  This is a wrapper for vboxtool. It is to be placed in /etc/init.d to provide auto
-+#  This is a wrapper for vboxtool. It is to be placed in /usr/loca/etc/rc.d to provide auto
- #  start at boot time and stop when the host is halted. Because it's a wrapper, the 
- #  original functions of vboxtool can be executed as usual, without cd'ing to 
--#  /etc/init.d.
-+#  /usr/local/etc/rc.d.
- #
--#  Usage: Should be placed in /etc/init.d
-+#  Usage: Should be placed in /usr/local/etc/rc.d
- #
- #  Copyright (C) 2008 Mark Baaijens <mark.baaijens at gmail.com>
- #
-@@ -44,7 +44,7 @@
- start()
- {
-   # 'vboxtoolinit start' maps to 'vboxtool autostart'; when the host boots, all sessions in 
--  # the config file /etc/vboxtool/machines.conf are started
-+  # the config file /usr/local/etc/vboxtool/machines.conf are started
-   nohup $su_command "vboxtool autostart" > /dev/null
- }
- 
-@@ -62,7 +62,7 @@
- }
- 
- # Some constants
--config_file='/etc/vboxtool/vboxtool.conf'
-+config_file='/usr/local/etc/vboxtool/vboxtool.conf'
- 
- # Retrieve settings from config file, just by executing the config file.
- # Config file $config_file should look like this:


>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-ports-bugs mailing list