diff --git a/sysutils/pfSense-pkg-Shellcmd/Makefile b/sysutils/pfSense-pkg-Shellcmd/Makefile new file mode 100644 index 000000000000..615b004641a5 --- /dev/null +++ b/sysutils/pfSense-pkg-Shellcmd/Makefile @@ -0,0 +1,39 @@ +# $FreeBSD$ + +PORTNAME= pfSense-pkg-Shellcmd +PORTVERSION= 0.6 +CATEGORIES= sysutils +MASTER_SITES= # empty +DISTFILES= # empty +EXTRACT_ONLY= # empty + +MAINTAINER= coreteam@pfsense.org +COMMENT= pfSense package Shellcmd + +NO_BUILD= yes +NO_MTREE= yes + +SUB_FILES= pkg-install pkg-deinstall +SUB_LIST= PORTNAME=${PORTNAME} + +do-extract: + ${MKDIR} ${WRKSRC} + +do-install: + ${MKDIR} ${STAGEDIR}${PREFIX}/pkg + ${MKDIR} ${STAGEDIR}${PREFIX}/www/packages/shellcmd + ${MKDIR} ${STAGEDIR}${DATADIR} + ${INSTALL_DATA} -m 0644 ${FILESDIR}${PREFIX}/pkg/shellcmd.xml \ + ${STAGEDIR}${PREFIX}/pkg + ${INSTALL_DATA} -m 0755 ${FILESDIR}${PREFIX}/pkg/shellcmd.xml \ + ${STAGEDIR}${PREFIX}/pkg + ${INSTALL_DATA} -m 0755 ${FILESDIR}${PREFIX}/pkg/shellcmd.inc \ + ${STAGEDIR}${PREFIX}/pkg + ${INSTALL_DATA} -m 0755 ${FILESDIR}${PREFIX}/www/packages/shellcmd/shellcmd.php \ + ${STAGEDIR}${PREFIX}/www/packages/shellcmd + ${INSTALL_DATA} -m 0755 ${FILESDIR}${PREFIX}/www/packages/shellcmd/shellcmd_edit.php \ + ${STAGEDIR}${PREFIX}/www/packages/shellcmd + ${INSTALL_DATA} ${FILESDIR}${DATADIR}/info.xml \ + ${STAGEDIR}${DATADIR} + +.include diff --git a/sysutils/pfSense-pkg-Shellcmd/files/pkg-deinstall.in b/sysutils/pfSense-pkg-Shellcmd/files/pkg-deinstall.in new file mode 100644 index 000000000000..0ea6111ea1cc --- /dev/null +++ b/sysutils/pfSense-pkg-Shellcmd/files/pkg-deinstall.in @@ -0,0 +1,3 @@ +#!/bin/sh + +/usr/local/sbin/fcgicli -f /etc/rc.packages -d "pkg=%%PORTNAME%%&when=${2}" diff --git a/sysutils/pfSense-pkg-Shellcmd/files/pkg-install.in b/sysutils/pfSense-pkg-Shellcmd/files/pkg-install.in new file mode 100644 index 000000000000..d9217e62d262 --- /dev/null +++ b/sysutils/pfSense-pkg-Shellcmd/files/pkg-install.in @@ -0,0 +1,7 @@ +#!/bin/sh + +if [ "${2}" != "POST-INSTALL" ]; then + exit 0 +fi + +/usr/local/sbin/fcgicli -f /etc/rc.packages -d "pkg=%%PORTNAME%%&when=${2}" diff --git a/sysutils/pfSense-pkg-Shellcmd/files/usr/local/pkg/shellcmd.inc b/sysutils/pfSense-pkg-Shellcmd/files/usr/local/pkg/shellcmd.inc new file mode 100644 index 000000000000..04cbf3d64128 --- /dev/null +++ b/sysutils/pfSense-pkg-Shellcmd/files/usr/local/pkg/shellcmd.inc @@ -0,0 +1,88 @@ + diff --git a/sysutils/pfSense-pkg-Shellcmd/files/usr/local/pkg/shellcmd.xml b/sysutils/pfSense-pkg-Shellcmd/files/usr/local/pkg/shellcmd.xml new file mode 100644 index 000000000000..094c3d30feb0 --- /dev/null +++ b/sysutils/pfSense-pkg-Shellcmd/files/usr/local/pkg/shellcmd.xml @@ -0,0 +1,115 @@ + + + + + + + + Shellcmd + Describe your package requirements here + Currently there are no FAQ items provided. + Shellcmd Settings + 0.4 + Settings + /usr/local/pkg/shellcmd.inc + + Shellcmd + shellcmd settings. +
Services
+ shellcmd.xml + /packages/shellcmd/shellcmd.php +
+ + + Settings + /pkg_edit.php?xml=shellcmd.xml&id=0 + + + + Settings + /packages/shellcmd/shellcmd.php + + + + installedpackages->package->$packagename->configuration->shellcmd + + /usr/local/pkg/ + 0755 + https://packages.pfsense.org/packages/config/shellcmd/shellcmd.xml + + + /usr/local/pkg/ + 0755 + https://packages.pfsense.org/packages/config/shellcmd/shellcmd.inc + + + /usr/local/www/packages/shellcmd/ + 0755 + https://packages.pfsense.org/packages/config/shellcmd/shellcmd.php + + + /usr/local/www/packages/shellcmd/ + 0755 + https://packages.pfsense.org/packages/config/shellcmd/shellcmd_edit.php + + + + Variable One + var1 + Enter the variable one here. + input + + + Variable Two + var1 + Enter the variable one here. + input + + + + + + shellcmd_sync_package(); + + + shellcmd_sync_package(); + + + shellcmd_install_command(); + + + shellcmd_deinstall_command(); + +
diff --git a/sysutils/pfSense-pkg-Shellcmd/files/usr/local/share/pfSense-pkg-Shellcmd/info.xml b/sysutils/pfSense-pkg-Shellcmd/files/usr/local/share/pfSense-pkg-Shellcmd/info.xml new file mode 100644 index 000000000000..68ee9d000d6d --- /dev/null +++ b/sysutils/pfSense-pkg-Shellcmd/files/usr/local/share/pfSense-pkg-Shellcmd/info.xml @@ -0,0 +1,14 @@ + + + + Shellcmd + + Services + https://packages.pfsense.org/packages/config/shellcmd/shellcmd.xml + 0.6 + Beta + 2.2 + markjcrane@gmail.com + shellcmd.xml + + diff --git a/sysutils/pfSense-pkg-Shellcmd/files/usr/local/www/packages/shellcmd/shellcmd.php b/sysutils/pfSense-pkg-Shellcmd/files/usr/local/www/packages/shellcmd/shellcmd.php new file mode 100644 index 000000000000..fd386910d205 --- /dev/null +++ b/sysutils/pfSense-pkg-Shellcmd/files/usr/local/www/packages/shellcmd/shellcmd.php @@ -0,0 +1,179 @@ + + + + + +

Shellcmd: Settings

+ +
+ + +
+ +
+ + + + + +
+ +
+"; +//print_info_box_np("This is an info box."); +//echo"
"; +//endif; + +?> + + + + +

+ The shellcmd utility is used to manage commands on system startup. +

+ +

+
+ + + + + + + + + + 0) { + foreach ($$category_config as $ent) { + // previous versions of shellcmd stored the command in an additional -xmltag, this unnests this for backwards compatibility + if (is_array($ent)) { $ent = $ent['command']; } + + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " "; + $i++; + } + } + } + + +?> + + + + + + + + + + + +
CommandType + + + + + + +
+ +
\n"; + echo " ".$ent."\n"; + echo " \n"; + echo " ".$category."\n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo "
\n"; + echo "
+ + + + + +
+
+ +
+ + +
+
+
+
+
+
+
+
+ +
+ +
+ + + + + diff --git a/sysutils/pfSense-pkg-Shellcmd/files/usr/local/www/packages/shellcmd/shellcmd_edit.php b/sysutils/pfSense-pkg-Shellcmd/files/usr/local/www/packages/shellcmd/shellcmd_edit.php new file mode 100644 index 000000000000..5ae466d5bf4c --- /dev/null +++ b/sysutils/pfSense-pkg-Shellcmd/files/usr/local/www/packages/shellcmd/shellcmd_edit.php @@ -0,0 +1,303 @@ +0) { + $id = $_POST['id']; +} + +$type = $_GET['t']; +if (strlen($_POST['t'])>0) { + $type = $_POST['t']; +} + +if ($_GET['act'] == "del") { + if ($_GET['type'] == 'cmd') { + + switch (htmlspecialchars($type)) { + case "earlyshellcmd": + $a_earlyshellcmd = &$config['system']['earlyshellcmd']; + unset($a_earlyshellcmd[$_GET['id']]); + write_config(); + shellcmd_sync_package(); + header("Location: shellcmd.php"); + exit; + break; + case "shellcmd": + $a_shellcmd = &$config['system']['shellcmd']; + unset($a_shellcmd[$_GET['id']]); + write_config(); + shellcmd_sync_package(); + header("Location: shellcmd.php"); + exit; + break; + case "afterfilterchangeshellcmd": + // $a_afterfilterchangeshellcmd = &$config['system']['afterfilterchangeshellcmd']; + // unset($a_afterfilterchangeshellcmd[$_GET['id']]); + // write_config(); + // shellcmd_sync_package(); + // header("Location: shellcmd.php"); + // exit; + break; + default: + break; + } + + } +} + +//get value for the form edit value +if (strlen($id) > 0) { + + switch (htmlspecialchars($type)) { + case "earlyshellcmd": + $a_earlyshellcmd = &$config['system']['earlyshellcmd']; + if ($a_earlyshellcmd[$id]) { + $pconfig['command'] = $a_earlyshellcmd[$id]; + } + break; + case "shellcmd": + $a_shellcmd = &$config['system']['shellcmd']; + if ($a_shellcmd[$id]) { + $pconfig['command'] = $a_shellcmd[$id]; + } + break; + case "afterfilterchangeshellcmd": + //$a_afterfilterchangeshellcmd = &$config['system']['afterfilterchangeshellcmd']; + //if ($a_afterfilterchangeshellcmd[$id]) { + // $pconfig['command'] = $a_afterfilterchangeshellcmd[$id]; + //} + break; + default: + break; + } + + // previous version of shellcmd wrapped all commands in a -xmltag, unnesting this for backwards compatibility + if (is_array($pconfig['command'])) $pconfig['command'] = $pconfig['command']['command']; + +} + +if ($_POST) { + + unset($input_errors); + + if (!$input_errors) { + if (strlen($_POST['command']) > 0) { + + $ent = $_POST['command']; + + if (strlen($id)>0) { + //update + + switch (htmlspecialchars($type)) { + case "earlyshellcmd": + $a_earlyshellcmd = &$config['system']['earlyshellcmd']; + if ($a_earlyshellcmd[$id]) { + $a_earlyshellcmd[$id] = $ent; + } + break; + case "shellcmd": + $a_shellcmd = &$config['system']['shellcmd']; + if ($a_shellcmd[$id]) { + $a_shellcmd[$id] = $ent; + } + break; + case "afterfilterchangeshellcmd": + //$a_afterfilterchangeshellcmd = &$config['system']['afterfilterchangeshellcmd']; + //if ($a_afterfilterchangeshellcmd[$id]) { + // $a_afterfilterchangeshellcmd[$id] = $ent; + //} + break; + default: + break; + } + + } + else { + //add + switch (htmlspecialchars($type)) { + case "earlyshellcmd": + $a_earlyshellcmd = &$config['system']['earlyshellcmd']; + $a_earlyshellcmd[] = $ent; + break; + case "shellcmd": + $a_shellcmd = &$config['system']['shellcmd']; + $a_shellcmd[] = $ent; + break; + case "afterfilterchangeshellcmd": + //$a_afterfilterchangeshellcmd = &$config['system']['afterfilterchangeshellcmd']; + //$a_afterfilterchangeshellcmd[] = $ent; + break; + default: + break; + } + + } + + write_config(); + shellcmd_sync_package(); + } + + header("Location: shellcmd.php"); + exit; + } +} + +include("head.inc"); + +?> + + + + + +

Shellcmd: Edit

+ + +
+ + +
+ +
+ + + + +
+ + +
+ + +
+ + + + + + + + + + + + + + + + + + +
Command + +
Type + \n"; + echo " \n"; + switch (htmlspecialchars($type)) { + case "earlyshellcmd": + echo " \n"; + echo " \n"; + //echo " \n"; + break; + case "shellcmd": + echo " \n"; + echo " \n"; + //echo " \n"; + break; + case "afterfilterchangeshellcmd": + //echo " \n"; + //echo " \n"; + //echo " \n"; + break; + default: + echo " \n"; + echo " \n"; + echo " \n"; + //echo " \n"; + break; + } + echo " \n"; + ?> +
  + 0) { ?> + + + +
+
+ +
+
+
+
+
+
+ +
+ +
+ + + + diff --git a/sysutils/pfSense-pkg-Shellcmd/pkg-descr b/sysutils/pfSense-pkg-Shellcmd/pkg-descr new file mode 100644 index 000000000000..2751a758e6d0 --- /dev/null +++ b/sysutils/pfSense-pkg-Shellcmd/pkg-descr @@ -0,0 +1 @@ +The shellcmd utility is used to manage commands on system startup. diff --git a/sysutils/pfSense-pkg-Shellcmd/pkg-plist b/sysutils/pfSense-pkg-Shellcmd/pkg-plist new file mode 100644 index 000000000000..58a1c69515b2 --- /dev/null +++ b/sysutils/pfSense-pkg-Shellcmd/pkg-plist @@ -0,0 +1,5 @@ +pkg/shellcmd.xml +pkg/shellcmd.inc +www/packages/shellcmd/shellcmd.php +www/packages/shellcmd/shellcmd_edit.php +%%DATADIR%%/info.xml