[RFC PATCH 1/9] utils/pb-plugin: Add non-interactive install
Samuel Mendoza-Jonas
sam at mendozajonas.com
Wed Feb 15 15:35:33 AEDT 2017
Allow pb-plugin to install a plugin without user interaction (ie.
confirmation), and add it to lib/system so it can be called from within
Petitboot.
Signed-off-by: Samuel Mendoza-Jonas <sam at mendozajonas.com>
---
configure.ac | 1 +
lib/system/system.c | 1 +
lib/system/system.h | 1 +
utils/pb-plugin | 30 +++++++++++++++++++-----------
4 files changed, 22 insertions(+), 11 deletions(-)
diff --git a/configure.ac b/configure.ac
index 1496054..408bd90 100644
--- a/configure.ac
+++ b/configure.ac
@@ -332,6 +332,7 @@ DEFINE_HOST_PROG(UMOUNT, umount, [/bin/umount])
DEFINE_HOST_PROG(WGET, wget, [/usr/bin/wget])
DEFINE_HOST_PROG(IP, ip, [/sbin/ip])
DEFINE_HOST_PROG(UDHCPC, udhcpc, [/sbin/udhcpc])
+DEFINE_HOST_PROG(PB_PLUGIN, pb-plugin, [/usr/sbin/pb-plugin])
AC_ARG_WITH(
[tftp],
diff --git a/lib/system/system.c b/lib/system/system.c
index 917d444..b04ebd4 100644
--- a/lib/system/system.c
+++ b/lib/system/system.c
@@ -28,6 +28,7 @@ const struct pb_system_apps pb_system_apps = {
.wget = HOST_PROG_WGET,
.ip = HOST_PROG_IP,
.udhcpc = HOST_PROG_UDHCPC,
+ .pb_plugin = HOST_PROG_PB_PLUGIN,
};
#ifndef TFTP_TYPE
diff --git a/lib/system/system.h b/lib/system/system.h
index ab25101..e50302a 100644
--- a/lib/system/system.h
+++ b/lib/system/system.h
@@ -13,6 +13,7 @@ struct pb_system_apps {
const char *wget;
const char *ip;
const char *udhcpc;
+ const char *pb_plugin;
};
extern const struct pb_system_apps pb_system_apps;
diff --git a/utils/pb-plugin b/utils/pb-plugin
index e107f96..1a03f23 100755
--- a/utils/pb-plugin
+++ b/utils/pb-plugin
@@ -150,7 +150,12 @@ EOF
do_install()
{
- local url name file __dest
+ local url name file __dest auto
+
+ if [ "$1" == "auto" ]; then
+ auto=y
+ shift;
+ fi
url=$1
@@ -186,17 +191,20 @@ do_install()
sha256sum "$file" | cut -f1 -d' '
echo
- echo "Do you want to install this plugin? (y/N)"
- read resp
+ if [ -z "$auto" ]
+ then
+ echo "Do you want to install this plugin? (y/N)"
+ read resp
- case $resp in
- [yY]|[yY][eE][sS])
- ;;
- *)
- echo "Cancelled"
- exit 0
- ;;
- esac
+ case $resp in
+ [yY]|[yY][eE][sS])
+ ;;
+ *)
+ echo "Cancelled"
+ exit 0
+ ;;
+ esac
+ fi
__dest=$(mktemp -d)
gunzip -c "$file" | ( cd $__dest && cpio -i -d)
--
2.11.1
More information about the Petitboot
mailing list