autoport-chroot: added new user tool to make entering autoport chroot environment easier

This commit is contained in:
Silvan Calarco 2012-05-10 10:30:38 +02:00
parent 69ebabca44
commit 2cee9628ea
2 changed files with 46 additions and 0 deletions

View File

@ -44,6 +44,7 @@ install-dirs:
@$(INSTALL_DIR) $(DESTDIR)$(sysconfdir)/cron.daily
@$(INSTALL_DIR) $(DESTDIR)$(sysconfdir)/sysconfig
@$(INSTALL_DIR) $(DESTDIR)$(bindir)
@$(INSTALL_DIR) $(DESTDIR)$(sbindir)
@$(INSTALL_DIR) $(DESTDIR)$(pck_datadir)
@$(INSTALL_DIR) $(DESTDIR)$(pck_datadir)/template/autoupdate/spec-patches-build/old
@$(INSTALL_DIR) $(DESTDIR)$(pck_datadir)/template/autoupdate/spec-patches-update/old
@ -59,6 +60,7 @@ install-programs:
@$(INSTALL_SCRIPT) autodist $(DESTDIR)$(bindir)/autodist
@$(INSTALL_SCRIPT) autodist-tool $(DESTDIR)$(bindir)/autodist-tool
@$(INSTALL_SCRIPT) autoport $(DESTDIR)$(bindir)/autoport
@$(INSTALL_SCRIPT) autoport-chroot $(DESTDIR)$(sbindir)/autoport-chroot
@$(INSTALL_SCRIPT) autoport-fix-environment $(DESTDIR)$(bindir)/autoport-fix-environment
@$(INSTALL_SCRIPT) etc/autodist/scripts/* $(DESTDIR)$(configdir)/scripts/

44
autoport-chroot Executable file
View File

@ -0,0 +1,44 @@
#!/bin/bash
#
# autoport-chroot
# (c) 2012 by Silvan Calarco <silvan.calarco@mambasoft.it>
#
. /etc/sysconfig/autoport
CHROOT_TARGET=$1
function usage() {
echo "\
$0
"$"Copyright (C) 2012 Silvan Calarco <silvan.calarco@mambasoft.it>""
"$"Released under the terms of the GNU GPL v3 license"
echo "
"$"Enters autoport chroot environment.""
"$"Usage"":
$me chroot_target
"
}
[ "$CHROOT_TARGET" ] || {
usage
exit 1
}
[ "`uname -m`" = "x86_64" ] && HOST_IS_X86_64=1
for i in `seq 0 ${#AUTOPORT_ARCH[*]}`; do
[ "${AUTOPORT_CHROOT[$i]}" = "$CHROOT_TARGET" ] || continue
if [ "$HOST_IS_X86_64" -a "${AUTOPORT_ARCH[$i]}" != "x86_64" ]; then
CMD_PREFIX=linux32
else
CMD_PREFIX=
fi
echo "Entering ${AUTOPORT_CHROOT[$i]} autoport chroot environment"
$CMD_PREFIX /usr/sbin/chroot /var/autoport/${AUTOPORT_CHROOT[$i]} su -l ${AUTOPORT_CHROOT_USER[$i]}
exit 0
done
echo "$CHROOT_TARGET: undefined chroot target"
exit 1