webbuild: support automatic local environments when none is set in configuration
This commit is contained in:
parent
19233fce7d
commit
9cfdccccc0
@ -3,7 +3,6 @@
|
|||||||
# webbuild cgi script
|
# webbuild cgi script
|
||||||
# Copyright (c) 2012-2013 by Silvan Calarco <silvan.calarco@mambasoft.it>
|
# Copyright (c) 2012-2013 by Silvan Calarco <silvan.calarco@mambasoft.it>
|
||||||
#
|
#
|
||||||
. /etc/sysconfig/autoport
|
|
||||||
. /usr/share/autodist/webbuild-functions
|
. /usr/share/autodist/webbuild-functions
|
||||||
. /usr/share/autodist/webbuild-functions-private
|
. /usr/share/autodist/webbuild-functions-private
|
||||||
|
|
||||||
@ -20,6 +19,9 @@ if [ "$REQUEST" != "refresh" ]; then
|
|||||||
echo "`date` - USER=$USER&REQUEST=$REQUEST&ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGE&MAINTAINERMODE=$MAINTAINERMODE" >> $LOG
|
echo "`date` - USER=$USER&REQUEST=$REQUEST&ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGE&MAINTAINERMODE=$MAINTAINERMODE" >> $LOG
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# read configuration after cgi_getvars to prevent variables overriding
|
||||||
|
. /etc/sysconfig/autoport
|
||||||
|
|
||||||
echo -e "Content-type: text/xml\nPragma: no-cache\n"
|
echo -e "Content-type: text/xml\nPragma: no-cache\n"
|
||||||
echo -n "<webbuild>"
|
echo -n "<webbuild>"
|
||||||
|
|
||||||
@ -29,6 +31,7 @@ USER_ADMIN=
|
|||||||
USER_CANMAINTAIN=
|
USER_CANMAINTAIN=
|
||||||
USER_CANSENDMESSAGES=
|
USER_CANSENDMESSAGES=
|
||||||
USER=${USER/.*\/}
|
USER=${USER/.*\/}
|
||||||
|
|
||||||
if [ "$REMOTE_ADDR" = "127.0.0.1" -a "$USER" = "" ]; then
|
if [ "$REMOTE_ADDR" = "127.0.0.1" -a "$USER" = "" ]; then
|
||||||
USER=admin
|
USER=admin
|
||||||
fi
|
fi
|
||||||
@ -251,6 +254,26 @@ fi
|
|||||||
# Enabled users requests
|
# Enabled users requests
|
||||||
#
|
#
|
||||||
|
|
||||||
|
rm -f $WEBBUILD_STATEDIR/cache/config-dynamic
|
||||||
|
if [ "${#AUTOPORT_ARCH[*]}" = "0" ]; then
|
||||||
|
LOCAL_PACKAGER_USERS=`getent group packager | cut -d: -f4 | tr , ' '`
|
||||||
|
LOCAL_ARCH=`uname -m`
|
||||||
|
case $LOCAL_ARCH in
|
||||||
|
i386|i486|i686|athlon) LOCAL_ARCH="i586" ;;
|
||||||
|
esac
|
||||||
|
i=0
|
||||||
|
for u in $LOCAL_PACKAGER_USERS; do
|
||||||
|
cat >> $WEBBUILD_STATEDIR/cache/config-dynamic << _EOF
|
||||||
|
AUTOPORT_DISABLE[$i]=1
|
||||||
|
AUTOPORT_CHROOT_USER[$i]=$u
|
||||||
|
AUTOPORT_NATIVE[$i]=1
|
||||||
|
AUTOPORT_ARCH[$i]="$LOCAL_ARCH"
|
||||||
|
_EOF
|
||||||
|
i=$((i + 1))
|
||||||
|
done
|
||||||
|
. $WEBBUILD_STATEDIR/cache/config-dynamic
|
||||||
|
fi
|
||||||
|
|
||||||
# delete a note
|
# delete a note
|
||||||
if [ "$REQUEST" = "removenote" ]; then
|
if [ "$REQUEST" = "removenote" ]; then
|
||||||
if [ "$USER" = "$NOTEUSER" -o "$USER_ADMIN" ]; then
|
if [ "$USER" = "$NOTEUSER" -o "$USER_ADMIN" ]; then
|
||||||
@ -463,6 +486,7 @@ if [ "${AUTOPORT_CHROOT[$ENVIRONMENT]}" ]; then
|
|||||||
elif [ "${AUTOPORT_NATIVE[$ENVIRONMENT]}" ]; then
|
elif [ "${AUTOPORT_NATIVE[$ENVIRONMENT]}" ]; then
|
||||||
WORKINGROOT="/"
|
WORKINGROOT="/"
|
||||||
WORKINGHOME=`getent passwd ${AUTOPORT_CHROOT_USER[$ENVIRONMENT]} | cut -d: -f6`
|
WORKINGHOME=`getent passwd ${AUTOPORT_CHROOT_USER[$ENVIRONMENT]} | cut -d: -f6`
|
||||||
|
[ -e "$WORKINGHOME/RPM" ] || WORKINGHOME="/usr/src/"
|
||||||
BUILDLOGDIR="/home/${AUTOPORT_CHROOT_USER[$ENVIRONMENT]}/.autodist/log/"
|
BUILDLOGDIR="/home/${AUTOPORT_CHROOT_USER[$ENVIRONMENT]}/.autodist/log/"
|
||||||
AUTOPORTLOGDIR="/home/${AUTOPORT_CHROOT_USER[$ENVIRONMENT]}/.autoport/${AUTOPORT_ARCH[$ENVIRONMENT]}/"
|
AUTOPORTLOGDIR="/home/${AUTOPORT_CHROOT_USER[$ENVIRONMENT]}/.autoport/${AUTOPORT_ARCH[$ENVIRONMENT]}/"
|
||||||
else
|
else
|
||||||
@ -558,7 +582,7 @@ elif [ ! "$REQUEST" -o "$REQUEST" = "changeenvironment" -o "$REQUEST" = "switchm
|
|||||||
echo -n "onchange=ajax_getvalues(\"REQUEST=edit&ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&"
|
echo -n "onchange=ajax_getvalues(\"REQUEST=edit&ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&"
|
||||||
echo -n "PACKAGE=\"+encodeURIComponent(this.value)+\"&REQUEST=changespec\");>"
|
echo -n "PACKAGE=\"+encodeURIComponent(this.value)+\"&REQUEST=changespec\");>"
|
||||||
echo -n "<option value=\"\">-- Select a .spec file --</option>"
|
echo -n "<option value=\"\">-- Select a .spec file --</option>"
|
||||||
$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "ls *.spec | sed \"s|.spec$||\" | sort -f" | while read f; do
|
$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "ls *.spec 2>/dev/null| sed \"s|.spec$||\" | sort -f" | while read f; do
|
||||||
specname=${f/.spec}
|
specname=${f/.spec}
|
||||||
[ "$PACKAGE" = "$specname" ] && SELECTED="selected=\"selected\"" || SELECTED=
|
[ "$PACKAGE" = "$specname" ] && SELECTED="selected=\"selected\"" || SELECTED=
|
||||||
echo -n "<option value=\"$specname\" $SELECTED>${specname}</option>"
|
echo -n "<option value=\"$specname\" $SELECTED>${specname}</option>"
|
||||||
|
@ -9,6 +9,8 @@ PACKAGE=$4
|
|||||||
COMMAND=$5
|
COMMAND=$5
|
||||||
TMPFILE=$6
|
TMPFILE=$6
|
||||||
|
|
||||||
|
[ -e $WEBBUILD_STATEDIR/cache/config-dynamic ] && . $WEBBUILD_STATEDIR/cache/config-dynamic
|
||||||
|
|
||||||
echo "REQUEST: $@" >> $WEBBUILD_STATEDIR/commands_log
|
echo "REQUEST: $@" >> $WEBBUILD_STATEDIR/commands_log
|
||||||
if [ "$MODE" = "killtree" ]; then
|
if [ "$MODE" = "killtree" ]; then
|
||||||
KILLPID=$2
|
KILLPID=$2
|
||||||
@ -58,6 +60,7 @@ elif [ "${AUTOPORT_NATIVE[$ENVIRONMENT]}" ]; then
|
|||||||
ENVPREFIX=
|
ENVPREFIX=
|
||||||
ENVUSER=${AUTOPORT_CHROOT_USER[$ENVIRONMENT]}
|
ENVUSER=${AUTOPORT_CHROOT_USER[$ENVIRONMENT]}
|
||||||
WORKINGHOME=`getent passwd ${AUTOPORT_CHROOT_USER[$ENVIRONMENT]} | cut -d: -f6`
|
WORKINGHOME=`getent passwd ${AUTOPORT_CHROOT_USER[$ENVIRONMENT]} | cut -d: -f6`
|
||||||
|
[ -e "$WORKINGHOME/RPM" ] || WORKINGHOME="/usr/src/"
|
||||||
SUCMDPREFIX="su -l ${AUTOPORT_CHROOT_USER[$ENVIRONMENT]} -c"
|
SUCMDPREFIX="su -l ${AUTOPORT_CHROOT_USER[$ENVIRONMENT]} -c"
|
||||||
else
|
else
|
||||||
ENVPREFIX=
|
ENVPREFIX=
|
||||||
|
Loading…
Reference in New Issue
Block a user