@@ -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],
@@ -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
@@ -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;
@@ -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)
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@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(-)