Package: di-netbot-assistant Version: 0.36 Severity: wishlist Tags: patch di-netboot-assistant should be able to run as a non-privileged user.
* di-netboot-assistant downloads and manipulates data from the
network
* the tftproot does not actually need to be populated by the
superuser
* it's often nice to build up a tftproot (or more than one!) on a
comfortable machine as a non-privileged user and then rsync it to a
canonical tftproot.
The attached patch adds a couple of config variables that can be
overridden in the config file, and allows the
DI_NETBOOT_ASSISTANT_CONFIG environment variable to override the
default /etc/di-netboot-assistant/di-netboot-assistant.conf
configuration variable. It works for me if a point it at an alternate
config file that looks like this:
------------
TFTP_ROOT=~/.di-netboot-assistant/tftpboot
DL_CACHE=~/.di-netboot-assistant/cache
STATUS_LIB=~/.di-netboot-assistant/lib
MIRROR_REGEXPS="s=://ftp.debian.org/=://ftp.us.debian.org/debian/="
-------------
and of course i have to make the subdirectories before the initial
invocation:
mkdir -p ~/.di-netboot-assistant/{tftpboot,cache,lib}
But maybe these directories should be created by the invoker
automatically anyway if they don't exist?
Thanks for providing this handy tool,
--dkg
PS the patch also drops an unneeded trailing slash from the default
value for DL_CACHE
diff -ruN di-netboot-assistant-0.36/debian/changelog di-netboot-assistant-0.36.1/debian/changelog
--- di-netboot-assistant-0.36/debian/changelog 2008-07-23 02:38:08.000000000 -0400
+++ di-netboot-assistant-0.36.1/debian/changelog 2008-10-24 20:58:12.000000000 -0400
@@ -1,3 +1,9 @@
+di-netboot-assistant (0.36.1) experimental; urgency=low
+
+ * allowing di-netboot-assistant to be run by a non-privileged user.
+
+ -- Daniel Kahn Gillmor <[EMAIL PROTECTED]> Fri, 24 Oct 2008 20:58:12 -0400
+
di-netboot-assistant (0.36) unstable; urgency=low
* Implement the command rebuild-menu.
diff -ruN di-netboot-assistant-0.36/usr/bin/di-netboot-assistant di-netboot-assistant-0.36.1/usr/bin/di-netboot-assistant
--- di-netboot-assistant-0.36/usr/bin/di-netboot-assistant 2008-07-23 02:08:07.000000000 -0400
+++ di-netboot-assistant-0.36.1/usr/bin/di-netboot-assistant 2008-10-24 21:17:32.000000000 -0400
@@ -29,7 +29,9 @@
SYSLINUXMENU=menu.c32
SYSLINUX=/usr/lib/syslinux/
ELILO=/usr/lib/elilo/
-DL_CACHE=/var/cache/di-netboot-assistant/
+DL_CACHE=/var/cache/di-netboot-assistant
+STATUS_LIB=/var/lib/di-netboot-assistant
+CONFIG_DIR=/etc/di-netboot-assistant
TFTP_ROOT=/var/lib/tftpboot
REWRITEPKGPATH='\(debian\|ubuntu\)-installer'
UMASKOLD=`umask -p`
@@ -37,8 +39,8 @@
#MIRROR_REGEXPS=# Not defined on purpose, so user can pass the variable
umask 0022
-if [ -f /etc/di-netboot-assistant/di-netboot-assistant.conf ]; then
- . /etc/di-netboot-assistant/di-netboot-assistant.conf
+if [ -f "${DI_NETBOOT_ASSISTANT_CONFIG:-/etc/di-netboot-assistant/di-netboot-assistant.conf}" ]; then
+ . "${DI_NETBOOT_ASSISTANT_CONFIG:-/etc/di-netboot-assistant/di-netboot-assistant.conf}"
fi
# Declare some functions
@@ -113,16 +115,16 @@
[ ! -d "pxelinux.cfg" ] && mkdir "pxelinux.cfg"
echo "I: Building PXE-Linux' top-menu"
- print_do-not-edit_header "/etc/di-netboot-assistant/pxelinux.HEAD" > pxelinux.cfg/default
+ print_do-not-edit_header "${CONFIG_DIR}/pxelinux.HEAD" > pxelinux.cfg/default
if [ -n "$(find "$TFTP_ROOT/debian-installer" -type d -name pxelinux.cfg.serial-9600 2>/dev/null)" ]; then
cp pxelinux.cfg/default pxelinux.cfg/default.serial-9600
else
[ -f "pxelinux.cfg/default.serial-9600" ] && rm pxelinux.cfg/default.serial-9600
fi
- [ -f /etc/di-netboot-assistant/pxelinux.HEAD ] && grep -Ev "^##" /etc/di-netboot-assistant/pxelinux.HEAD >> pxelinux.cfg/default
+ [ -f ${CONFIG_DIR}/pxelinux.HEAD ] && grep -Ev "^##" ${CONFIG_DIR}/pxelinux.HEAD >> pxelinux.cfg/default
i=0
- for x in $(ls /var/lib/di-netboot-assistant/*.pxelinux.menu.fragment 2>/dev/null ); do
+ for x in $(ls "${STATUS_LIB}/"*.pxelinux.menu.fragment 2>/dev/null ); do
i=$(($i + 1))
grep -Ev "^##" $x >> pxelinux.cfg/default
echo "" >> pxelinux.cfg/default
@@ -132,8 +134,8 @@
i=0
if [ -f "pxelinux.cfg/default.serial-9600" ]; then
i=$(($i + 1))
- [ -f /etc/di-netboot-assistant/pxelinux.HEAD ] && cat /etc/di-netboot-assistant/pxelinux.HEAD >> pxelinux.cfg/default.serial-9600
- for x in /var/lib/di-netboot-assistant/*pxelinux.menu.serial-9600.fragment ; do
+ [ -f ${CONFIG_DIR}/pxelinux.HEAD ] && cat ${CONFIG_DIR}/pxelinux.HEAD >> pxelinux.cfg/default.serial-9600
+ for x in "${STATUS_LIB}/"*pxelinux.menu.serial-9600.fragment ; do
grep -Ev "^##" "$x" >> pxelinux.cfg/default.serial-9600
echo "" >> pxelinux.cfg/default.serial-9600
done
@@ -153,11 +155,11 @@
update_elilo_menu() {
echo "I: Building Elilo's top-menu"
- print_do-not-edit_header "/etc/di-netboot-assistant/elilo.HEAD" > elilo.conf
- [ -f /etc/di-netboot-assistant/elilo.HEAD ] && grep -Ev "^##" /etc/di-netboot-assistant/elilo.HEAD >> elilo.conf
+ print_do-not-edit_header "${CONFIG_DIR}/elilo.HEAD" > elilo.conf
+ [ -f ${CONFIG_DIR}/elilo.HEAD ] && grep -Ev "^##" "${CONFIG_DIR}/elilo.HEAD" >> elilo.conf
i=0
- for x in $(ls /var/lib/di-netboot-assistant/*.elilo.conf.fragment 2>/dev/null ); do
+ for x in $(ls "${STATUS_LIB}/"*.elilo.conf.fragment 2>/dev/null ); do
i=$(($i + 1))
grep -Ev "^##" $x >> elilo.conf
echo "" >> elilo.conf
@@ -237,7 +239,7 @@
purge_repos() {
[ "$DEBUG" ] && set -x
del_repo="$1"
- current_repos="$(find /var/lib/di-netboot-assistant/ -name $del_repo--\*.conf | sed -e 's/^.*--//' -e 's/\.conf//')"
+ current_repos="$(find "${STATUS_LIB}/" -name $del_repo--\*.conf | sed -e 's/^.*--//' -e 's/\.conf//')"
if [ "$(echo $ARCH | grep -E "\<all\>")" ]; then
archs="$current_repos"
@@ -246,8 +248,8 @@
fi
for a in $archs ; do
- if [ -f "/var/lib/di-netboot-assistant/$del_repo--$a.conf" ]; then
- purge_repo "/var/lib/di-netboot-assistant/$del_repo--$a.conf"
+ if [ -f "${STATUS_LIB}/$del_repo--$a.conf" ]; then
+ purge_repo "${STATUS_LIB}/$del_repo--$a.conf"
else
echo "E: Repository '$del_repo' for architecture '$a' doesn't exists." 1>&2
echo "I: (current repository are: $current_repos)" 1>&2
@@ -398,7 +400,7 @@
for arch in $archs ; do
echo "I: Processing $release/$arch ... "
- metadatabasename="/var/lib/di-netboot-assistant/${release}--${arch}"
+ metadatabasename="${STATUS_LIB}/${release}--${arch}"
metadatafile="$metadatabasename.conf"
repo_orig="$(grep -E "^$release[[:blank:]]$arch\>" "$DISOURCELIST")"
@@ -655,7 +657,7 @@
if [ $COUNT -eq 0 ]; then
echo "E: No repository name was passed for '$ACTION'." 1>&2
[ ! "$OFFLINE" -a "$ACTION" = "install" ] && echo "I: Declared repositories are: $releases" 1>&2
- [ "$ACTION" = "purge" ] && echo "I: Installed repositories are: $( cd /var/lib/di-netboot-assistant/ ; ls | sed -e 's/--.*//' | sort -u | tr "\n" " " )" 1>&2
+ [ "$ACTION" = "purge" ] && echo "I: Installed repositories are: $( cd "${STATUS_LIB}/" ; ls | sed -e 's/--.*//' | sort -u | tr "\n" " " )" 1>&2
echo "" 1>&2
exit 1
fi
diff -ruN di-netboot-assistant-0.36/usr/share/man/man1/di-netboot-assistant.1 di-netboot-assistant-0.36.1/usr/share/man/man1/di-netboot-assistant.1
--- di-netboot-assistant-0.36/usr/share/man/man1/di-netboot-assistant.1 2008-07-22 19:57:45.000000000 -0400
+++ di-netboot-assistant-0.36.1/usr/share/man/man1/di-netboot-assistant.1 2008-10-24 21:07:48.000000000 -0400
@@ -50,6 +50,12 @@
\fB\-\-offline\fR
Don't download the file (simply re\-extract and build menu)
.RE
+.SH "ENVIRONMENT VARIABLES"
+.TP
+\fBDI_NETBOOT_ASSISTANT_CONFIG\fR
+By default, the di-netboot-assistant configuration is pulled from \fI/etc/di-netboot-assistant/di-netboot-assistant.conf\fR. If you set \fBDI_NETBOOT_ASSISTANT_CONFIG\fR, di-netboot-assistant will pull its configuration from the designated file instead.
+
+.RE
.SH PROXY
di-na uses wget to actually download the files. You can set the environnement variables accordingly.
.SH AUTHOR
pgpOL0BHO1IPw.pgp
Description: PGP signature

