autoport-launcher, 65-autoport: new launcher and single cron script to improve background processes launch with systemd
This commit is contained in:
parent
f852838441
commit
a7cbefbe18
8
Makefile
8
Makefile
@ -1,5 +1,5 @@
|
|||||||
# Makefile for autodist
|
# Makefile for autodist
|
||||||
# Copyright (C) 2006-2014 by Silvan Calarco <silvan.calarco@mambasoft.it>
|
# Copyright (C) 2006-2021 by Silvan Calarco <silvan.calarco@mambasoft.it>
|
||||||
#
|
#
|
||||||
PACKAGE = autodist
|
PACKAGE = autodist
|
||||||
|
|
||||||
@ -71,8 +71,9 @@ install-programs:
|
|||||||
@$(INSTALL_SCRIPT) autodist $(DESTDIR)$(bindir)/autodist
|
@$(INSTALL_SCRIPT) autodist $(DESTDIR)$(bindir)/autodist
|
||||||
@$(INSTALL_SCRIPT) autodist-tool $(DESTDIR)$(bindir)/autodist-tool
|
@$(INSTALL_SCRIPT) autodist-tool $(DESTDIR)$(bindir)/autodist-tool
|
||||||
@$(INSTALL_SCRIPT) autoport $(DESTDIR)$(bindir)/autoport
|
@$(INSTALL_SCRIPT) autoport $(DESTDIR)$(bindir)/autoport
|
||||||
@$(INSTALL_SCRIPT) automaint $(DESTDIR)$(sbindir)/automaint
|
@$(INSTALL_SCRIPT) autoport-launcher $(DESTDIR)$(bindir)/autoport-launcher
|
||||||
@$(INSTALL_SCRIPT) autoport-chroot $(DESTDIR)$(sbindir)/autoport-chroot
|
@$(INSTALL_SCRIPT) autoport-chroot $(DESTDIR)$(sbindir)/autoport-chroot
|
||||||
|
@$(INSTALL_SCRIPT) automaint $(DESTDIR)$(sbindir)/automaint
|
||||||
@$(INSTALL_SCRIPT) autodist-repository $(DESTDIR)$(sbindir)/autodist-repository
|
@$(INSTALL_SCRIPT) autodist-repository $(DESTDIR)$(sbindir)/autodist-repository
|
||||||
@$(INSTALL_SCRIPT) autodist-upstream-updates $(DESTDIR)$(sbindir)/autodist-upstream-updates
|
@$(INSTALL_SCRIPT) autodist-upstream-updates $(DESTDIR)$(sbindir)/autodist-upstream-updates
|
||||||
@$(INSTALL_SCRIPT) autoport-fix-environment $(DESTDIR)$(bindir)/autoport-fix-environment
|
@$(INSTALL_SCRIPT) autoport-fix-environment $(DESTDIR)$(bindir)/autoport-fix-environment
|
||||||
@ -96,8 +97,7 @@ install-data:
|
|||||||
@$(INSTALL_DATA) webbuild/webbuild-admin $(DESTDIR)$(localstatedir)/webbuild/users/admin.conf
|
@$(INSTALL_DATA) webbuild/webbuild-admin $(DESTDIR)$(localstatedir)/webbuild/users/admin.conf
|
||||||
@$(INSTALL_SCRIPT) etc/sysconfig/autoport $(DESTDIR)$(sysconfdir)/sysconfig/autoport
|
@$(INSTALL_SCRIPT) etc/sysconfig/autoport $(DESTDIR)$(sysconfdir)/sysconfig/autoport
|
||||||
@$(INSTALL_SCRIPT) etc/cron.hourly/60-autodist-update $(DESTDIR)$(sysconfdir)/cron.hourly/
|
@$(INSTALL_SCRIPT) etc/cron.hourly/60-autodist-update $(DESTDIR)$(sysconfdir)/cron.hourly/
|
||||||
@$(INSTALL_SCRIPT) etc/cron.hourly/65-autoport-native $(DESTDIR)$(sysconfdir)/cron.hourly/
|
@$(INSTALL_SCRIPT) etc/cron.hourly/65-autoport $(DESTDIR)$(sysconfdir)/cron.hourly/
|
||||||
@$(INSTALL_SCRIPT) etc/cron.hourly/66-autoport-chroot $(DESTDIR)$(sysconfdir)/cron.hourly/
|
|
||||||
@$(INSTALL_SCRIPT) etc/cron.daily/40-autodist-cleanold $(DESTDIR)$(sysconfdir)/cron.daily/
|
@$(INSTALL_SCRIPT) etc/cron.daily/40-autodist-cleanold $(DESTDIR)$(sysconfdir)/cron.daily/
|
||||||
@$(INSTALL_SCRIPT) etc/cron.daily/40-autodist-upstream-updates $(DESTDIR)$(sysconfdir)/cron.daily/
|
@$(INSTALL_SCRIPT) etc/cron.daily/40-autodist-upstream-updates $(DESTDIR)$(sysconfdir)/cron.daily/
|
||||||
@$(INSTALL_SCRIPT) etc/logrotate.d/webbuild $(DESTDIR)$(sysconfdir)/logrotate.d/webbuild
|
@$(INSTALL_SCRIPT) etc/logrotate.d/webbuild $(DESTDIR)$(sysconfdir)/logrotate.d/webbuild
|
||||||
|
21
autoport
21
autoport
@ -1,6 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# autoport -- batch cross-build tool based on autodist
|
# autoport -- batch cross-build tool based on autodist
|
||||||
# Copyright (C) 2011-2020 by Silvan Calarco <silvan.calarco@mambasoft.it>
|
# Copyright (C) 2011-2021 by Silvan Calarco <silvan.calarco@mambasoft.it>
|
||||||
#
|
#
|
||||||
# Released under the terms of the GNU GPL release 3 license
|
# Released under the terms of the GNU GPL release 3 license
|
||||||
#
|
#
|
||||||
@ -329,6 +329,19 @@ done
|
|||||||
|
|
||||||
[ "$DEST_REPOSITORY" ] || DEST_REPOSITORY=$PORT_REPOSITORY
|
[ "$DEST_REPOSITORY" ] || DEST_REPOSITORY=$PORT_REPOSITORY
|
||||||
|
|
||||||
|
if [ "$BATCH_MODE" ]; then
|
||||||
|
PIDFILE="/run/autodist/autoport-${BUILD_ARCH}-${PORT_REPOSITORY}.pid"
|
||||||
|
[ -e $PIDFILE ] && {
|
||||||
|
PIDCHECK=`cat $PIDFILE`
|
||||||
|
[ "$PIDCHECK" -a -e /proc/$PIDCHECK -a ! "$DISABLE_PID_CHECK" ] && {
|
||||||
|
echo "Error: autoport -b already running with PID=$PIDCHECK.Aborting."
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
echo $$ > $PIDFILE
|
||||||
|
trap "rm -f $PIDFILE; exit 1" SIGQUIT SIGINT SIGKILL SIGTERM
|
||||||
|
fi
|
||||||
|
|
||||||
for TARGET_ARCH in ${TARGET_ARCHS}; do
|
for TARGET_ARCH in ${TARGET_ARCHS}; do
|
||||||
|
|
||||||
JOBS_SKIPPED=()
|
JOBS_SKIPPED=()
|
||||||
@ -411,6 +424,7 @@ for TARGET_ARCH in ${TARGET_ARCHS}; do
|
|||||||
[ "$FIX_MODE" -o "$BATCH_MODE" -o "${JOB[*]}" ] || { echo "Nothing to do."; exit 0; }
|
[ "$FIX_MODE" -o "$BATCH_MODE" -o "${JOB[*]}" ] || { echo "Nothing to do."; exit 0; }
|
||||||
|
|
||||||
if [ "$BATCH_MODE" ]; then
|
if [ "$BATCH_MODE" ]; then
|
||||||
|
|
||||||
[ "${JOB[*]}" ] && {
|
[ "${JOB[*]}" ] && {
|
||||||
echo "Error: no jobs allowed in batch mode; aborting."
|
echo "Error: no jobs allowed in batch mode; aborting."
|
||||||
exit 1
|
exit 1
|
||||||
@ -557,8 +571,8 @@ for TARGET_ARCH in ${TARGET_ARCHS}; do
|
|||||||
autoport_log ${JOB_CURRENT} prepare failed $tmpfile
|
autoport_log ${JOB_CURRENT} prepare failed $tmpfile
|
||||||
continue
|
continue
|
||||||
} || {
|
} || {
|
||||||
spec_version=`grep "^Version:" ${SPECDIR}/${JOB_CURRENT}.spec | awk '{ print $2}'`
|
spec_version=`grep -m1 "^Version:" ${SPECDIR}/${JOB_CURRENT}.spec | awk '{ print $2}'`
|
||||||
spec_release=`grep "^Release:" ${SPECDIR}/${JOB_CURRENT}.spec | awk '{ print $2}'`
|
spec_release=`grep -m1 "^Release:" ${SPECDIR}/${JOB_CURRENT}.spec | awk '{ print $2}'`
|
||||||
if [ "${spec_version}-${spec_release}" != "$src_version-$src_release" ]; then
|
if [ "${spec_version}-${spec_release}" != "$src_version-$src_release" ]; then
|
||||||
echo "< (FAILED) [wrong version ${src_version}-${src_release} != ${spec_version}-${spec_release}]"
|
echo "< (FAILED) [wrong version ${src_version}-${src_release} != ${spec_version}-${spec_release}]"
|
||||||
JOB_CANTPREPARE=(${JOB_CANTPREPARE[*]} $JOB_CURRENT)
|
JOB_CANTPREPARE=(${JOB_CANTPREPARE[*]} $JOB_CURRENT)
|
||||||
@ -789,4 +803,5 @@ MESSAGE=`cgi_encodevar \"ported <b>$JOB_CURRENT</b> to <b>$TARGET_ARCH</b> and s
|
|||||||
rm -f $tmpfile $tmpfile1
|
rm -f $tmpfile $tmpfile1
|
||||||
done
|
done
|
||||||
echo "* All jobs completed. See $logfile for details."
|
echo "* All jobs completed. See $logfile for details."
|
||||||
|
[ "$BATCH_MODE" ] && rm -f $PIDFILE
|
||||||
exit ${#JOB_FAILED[*]}
|
exit ${#JOB_FAILED[*]}
|
||||||
|
111
autoport-launcher
Executable file
111
autoport-launcher
Executable file
@ -0,0 +1,111 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# autoport launcher
|
||||||
|
# (c) 2021 by Silvan Calarco <silvan.calarco@mambasoft.it>
|
||||||
|
#
|
||||||
|
#. /etc/sysconfig/openmamba-central
|
||||||
|
. /etc/sysconfig/autoport
|
||||||
|
|
||||||
|
[ "$AUTOPORT_ENABLE" = "1" -o "$AUTOPORT_ENABLE" = "true" ] || exit 0
|
||||||
|
|
||||||
|
i=$1
|
||||||
|
|
||||||
|
[ "$i" ] || {
|
||||||
|
echo "Usage: autoport-launcher autoport_conf"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
[ "`uname -m`" = "x86_64" ] && HOST_IS_X86_64=1
|
||||||
|
|
||||||
|
[ "${AUTOPORT_DISABLE[$i]}" -a "${AUTOPORT_DISABLE[$i]}" != "0" ] && exit 0
|
||||||
|
|
||||||
|
PIDFILE=/run/autodist/autoport-launcher-${i}.pid
|
||||||
|
[ -e $PIDFILE ] && {
|
||||||
|
PIDCHECK=`cat $PIDFILE`
|
||||||
|
[ "$PIDCHECK" -a -e /proc/$PIDCHECK ] && {
|
||||||
|
echo "autoport-launcher for configuration $i already running; exiting."
|
||||||
|
exit 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
echo $$ > $PIDFILE
|
||||||
|
trap "rm -f $PIDFILE; exit 1" SIGQUIT SIGINT SIGKILL SIGTERM
|
||||||
|
|
||||||
|
if [ "$HOST_IS_X86_64" -a "${AUTOPORT_ARCH[$i]}" != "x86_64" ]; then
|
||||||
|
CMD_PREFIX=linux32
|
||||||
|
else
|
||||||
|
CMD_PREFIX=
|
||||||
|
fi
|
||||||
|
|
||||||
|
UPDATE_DONE=
|
||||||
|
|
||||||
|
for r in ${AUTOPORT_REPOSITORIES[$i]}; do
|
||||||
|
|
||||||
|
if [ "${AUTOPORT_NATIVE[$i]}" ]; then
|
||||||
|
AUTOPORT_PIDFILE="/run/autodist/autoport-${AUTOPORT_ARCH[$i]}-$r.pid"
|
||||||
|
LOGFILE="/var/autodist/log/autoport-native-$r-${AUTOPORT_ARCH[$i]}.log"
|
||||||
|
LASTLOGFILE="/var/autodist/log/autoport-native-$r-${AUTOPORT_ARCH[$i]}-last.log"
|
||||||
|
elif [ "${AUTOPORT_CHROOT[$i]}" ]; then
|
||||||
|
AUTOPORT_PIDFILE="/var/autoport/${AUTOPORT_CHROOT[$i]}/run/autodist/autoport-${AUTOPORT_ARCH[$i]}-$r.pid"
|
||||||
|
LOGFILE="/var/autodist/log/autoport-chroot-$r-${AUTOPORT_CHROOT[$i]}.log"
|
||||||
|
LASTLOGFILE="/var/autodist/log/autoport-chroot-$r-${AUTOPORT_CHROOT[$i]}-last.log"
|
||||||
|
elif [ "${AUTOPORT_CROSS[$i]}" ]; then
|
||||||
|
AUTOPORT_PIDFILE="/run/autoport/autoport-${AUTOPORT_ARCH[$i]}-$r.pid"
|
||||||
|
LOGFILE="/var/autodist/log/autoport-cross-$r-${AUTOPORT_CROSS[$i]}.log"
|
||||||
|
LASTLOGFILE="/var/autodist/log/autoport-cross-$r-${AUTOPORT_CROSS[$i]}-last.log"
|
||||||
|
else
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$UPDATE_DONE" == "" ]; then
|
||||||
|
if [ "${AUTOPORT_NATIVE[$i]}" ]; then
|
||||||
|
[[ "`/usr/bin/tty`" != "not a tty" ]] && echo "Updating packages in ${AUTOPORT_ARCH[$i]} native environment"
|
||||||
|
echo "= Updating packages in ${AUTOPORT_ARCH[$i]} native environment..." >> $LOGFILE
|
||||||
|
LANG=C dnf update -y >> $LOGFILE
|
||||||
|
UPDATE_DONE=1
|
||||||
|
elif [ "${AUTOPORT_CHROOT[$i]}" ]; then
|
||||||
|
[[ "`/usr/bin/tty`" != "not a tty" ]] && echo "Updating packages in ${AUTOPORT_CHROOT[$i]} chroot environment"
|
||||||
|
#echo "= Updating packages in ${AUTOPORT_CHROOT[$i]} chroot environment..." >> $LOGFILE
|
||||||
|
LANG=C /usr/sbin/chroot /var/autoport/${AUTOPORT_CHROOT[$i]} dnf update -y > /dev/null
|
||||||
|
#[ "${AUTOPORT_CHROOT_ICECREAM[$i]}" ] && LANG=C /usr/sbin/chroot /var/autoport/${AUTOPORT_CHROOT[$i]} /etc/init.d/icecream start
|
||||||
|
UPDATE_DONE=1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -e $AUTOPORT_PIDFILE ]; then
|
||||||
|
PIDCHECK=`cat $AUTOPORT_PIDFILE`
|
||||||
|
if [ "$PIDCHECK" -a -e /proc/$PIDCHECK ]; then
|
||||||
|
echo "autoport for configuration $i already running; continuing."
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
[ -e $LOGFILE ] && mv $LOGFILE $LASTLOGFILE
|
||||||
|
|
||||||
|
echo "+ Autoport start at `date`" > $LOGFILE
|
||||||
|
echo "============================================" >> $LOGFILE
|
||||||
|
|
||||||
|
if [ "${AUTOPORT_NATIVE[$i]}" ]; then
|
||||||
|
echo "= Working on $r(${AUTOPORT_ARCH[$i]}) in native mode" >> $LOGFILE
|
||||||
|
su -l ${AUTOPORT_CHROOT_USER[$i]} -c "$CMD_PREFIX autoport -b -r $r" >> $LOGFILE
|
||||||
|
AUTODIST_HOME=`getent passwd ${AUTOPORT_CHROOT_USER[$i]} | cut -d: -f6`
|
||||||
|
cat $AUTODIST_HOME/.autoport/${AUTOPORT_ARCH[$i]}/$r-current.log >> $LOGFILE
|
||||||
|
elif [ "${AUTOPORT_CHROOT[$i]}" ]; then
|
||||||
|
echo "= Working on $r(${AUTOPORT_CHROOT[$i]}) in chroot mode..." >> $LOGFILE
|
||||||
|
$CMD_PREFIX /usr/sbin/chroot /var/autoport/${AUTOPORT_CHROOT[$i]} su -l ${AUTOPORT_CHROOT_USER[$i]} -c "autoport -b -r $r" >> $LOGFILE
|
||||||
|
if [ "${AUTOPORT_CHROOT_USER[$i]}" = "autodist" ]; then
|
||||||
|
cat /var/autoport/${AUTOPORT_CHROOT[$i]}/var/autodist/.autoport/${AUTOPORT_ARCH[$i]}/$r-current.log >> $LOGFILE
|
||||||
|
else
|
||||||
|
cat /var/autoport/${AUTOPORT_CHROOT[$i]}/home/${AUTOPORT_CHROOT_USER[$i]}/.autoport/${AUTOPORT_ARCH[$i]}/$r-current.log >> $LOGFILE
|
||||||
|
fi
|
||||||
|
elif [ "${AUTOPORT_CROSS[$i]}" ]; then
|
||||||
|
[[ "`/usr/bin/tty`" != "not a tty" ]] && echo "Working on $r(${AUTOPORT_CROSS[$i]}) in cross-platform mode"
|
||||||
|
echo "= Working on $r(${AUTOPORT_CROSS[$i]}) in cross-platform mode" >> $LOGFILE
|
||||||
|
su -l autodist -c "autoport -b -x ${AUTOPORT_CROSS[$i]} -r $r" >> $LOGFILE
|
||||||
|
cat /var/autodist/.autoport/${AUTOPORT_CROSS[$i]}/$r-current.log >> $LOGFILE
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "- Autoport end at `date`" >> $LOGFILE
|
||||||
|
echo "============================================" >> $LOGFILE
|
||||||
|
|
||||||
|
done
|
||||||
|
rm -f ${PIDFILE}
|
14
etc/cron.hourly/65-autoport
Executable file
14
etc/cron.hourly/65-autoport
Executable file
@ -0,0 +1,14 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# openmamba-autobuild-autoport daily cron script
|
||||||
|
# (c) 2008-2021 by Silvan Calarco <silvan.calarco@mambasoft.it>
|
||||||
|
#
|
||||||
|
#. /etc/sysconfig/openmamba-central
|
||||||
|
. /etc/sysconfig/autoport
|
||||||
|
|
||||||
|
[ "$AUTOPORT_ENABLE" = "1" -o "$AUTOPORT_ENABLE" = "true" ] || exit 0
|
||||||
|
|
||||||
|
for i in `seq 0 ${#AUTOPORT_ARCH[*]}`; do
|
||||||
|
echo "Running autoport-launcher ${i} `date`"
|
||||||
|
systemd-run /usr/bin/autoport-launcher ${i}
|
||||||
|
done
|
@ -1,84 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
#
|
|
||||||
# openmamba-autobuild-autoport daily cron script
|
|
||||||
# (c) 2008-2020 by Silvan Calarco <silvan.calarco@mambasoft.it>
|
|
||||||
#
|
|
||||||
#. /etc/sysconfig/openmamba-central
|
|
||||||
. /etc/sysconfig/autoport
|
|
||||||
|
|
||||||
[ "$AUTOPORT_ENABLE" = "1" -o "$AUTOPORT_ENABLE" = "true" ] || exit 0
|
|
||||||
|
|
||||||
ME=`basename $0`
|
|
||||||
[ "$$" == "`pidof -x $ME`" ] || {
|
|
||||||
[[ "`/usr/bin/tty`" != "not a tty" ]] && echo "Warning: $ME script already running; exiting."
|
|
||||||
exit 0
|
|
||||||
}
|
|
||||||
|
|
||||||
PIDFILE=/run/autodist/autoport.pid
|
|
||||||
HOUR=`date +%H`
|
|
||||||
[ "`uname -m`" = "x86_64" ] && HOST_IS_X86_64=1
|
|
||||||
|
|
||||||
function pid_check() {
|
|
||||||
|
|
||||||
[ -e $PIDFILE ] && PIDCHECK=`cat $PIDFILE`
|
|
||||||
|
|
||||||
[ "$PIDCHECK" -a -e /proc/$PIDCHECK ] && {
|
|
||||||
echo "Error: an autodist process is already running; exiting for safety."
|
|
||||||
exit 0
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pid_check
|
|
||||||
|
|
||||||
NATIVE_UPGRADED=
|
|
||||||
|
|
||||||
for i in `seq 0 ${#AUTOPORT_ARCH[*]}`; do
|
|
||||||
for r in ${AUTOPORT_REPOSITORIES[$i]}; do
|
|
||||||
[ "${AUTOPORT_ARCH[$i]}" ] || continue
|
|
||||||
[ "${AUTOPORT_DISABLE[$i]}" -a "${AUTOPORT_DISABLE[$i]}" != "0" ] && continue
|
|
||||||
|
|
||||||
if [ "$HOST_IS_X86_64" -a "${AUTOPORT_ARCH[$i]}" != "x86_64" ]; then
|
|
||||||
CMD_PREFIX=linux32
|
|
||||||
else
|
|
||||||
CMD_PREFIX=
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "${AUTOPORT_NATIVE[$i]}" ]; then
|
|
||||||
LOGFILE="/var/autodist/log/autoport-native-$r-${AUTOPORT_ARCH[$i]}.log"
|
|
||||||
LASTLOGFILE="/var/autodist/log/autoport-native-$r-${AUTOPORT_ARCH[$i]}-last.log"
|
|
||||||
else
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
[ -e $LOGFILE ] && mv $LOGFILE $LASTLOGFILE
|
|
||||||
|
|
||||||
echo "+ Autoport start at `date`" > $LOGFILE
|
|
||||||
echo "============================================" >> $LOGFILE
|
|
||||||
|
|
||||||
if [ "${AUTOPORT_NATIVE[$i]}" ]; then
|
|
||||||
a=${AUTOPORT_ARCH[$i]}
|
|
||||||
if [ ! "$NATIVE_UPGRADED" ]; then
|
|
||||||
[[ "`/usr/bin/tty`" != "not a tty" ]] && echo "Updating packages in $a native environment"
|
|
||||||
echo "= Updating packages in $a native environment..." >> $LOGFILE
|
|
||||||
LANG=C dnf update -y >> $LOGFILE
|
|
||||||
NATIVE_UPGRADED=1
|
|
||||||
fi
|
|
||||||
echo "= Working on $r($a) in native mode" >> $LOGFILE
|
|
||||||
su -l ${AUTOPORT_CHROOT_USER[$i]} -c "$CMD_PREFIX autoport -b -r $r" >> $LOGFILE
|
|
||||||
AUTODIST_HOME=`getent passwd ${AUTOPORT_CHROOT_USER[$i]} | cut -d: -f6`
|
|
||||||
cat $AUTODIST_HOME/.autoport/$a/$r-current.log >> $LOGFILE
|
|
||||||
fi
|
|
||||||
|
|
||||||
# if [ "${AUTOPORT_CROSS[$i]}" ]; then
|
|
||||||
# a=${AUTOPORT_CROSS[$i]}
|
|
||||||
# [[ "`/usr/bin/tty`" != "not a tty" ]] && echo "Working on $r($a) in cross-platform mode"
|
|
||||||
# echo "= Working on $r($a) in cross-platform mode" >> $LOGFILE
|
|
||||||
# su -l autodist -c "autoport -b -x $a -r $r" >> $LOGFILE
|
|
||||||
# cat /var/autodist/.autoport/$a/$r-current.log >> $LOGFILE
|
|
||||||
# fi
|
|
||||||
|
|
||||||
echo "- Autoport end at `date`" >> $LOGFILE
|
|
||||||
echo "============================================" >> $LOGFILE
|
|
||||||
|
|
||||||
done
|
|
||||||
done
|
|
@ -1,109 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
#
|
|
||||||
# openmamba-autobuild-autoport daily cron script
|
|
||||||
# (c) 2008-2020 by Silvan Calarco <silvan.calarco@mambasoft.it>
|
|
||||||
#
|
|
||||||
#. /etc/sysconfig/openmamba-central
|
|
||||||
. /etc/sysconfig/autoport
|
|
||||||
|
|
||||||
[ "$AUTOPORT_ENABLE" = "1" -o "$AUTOPORT_ENABLE" = "true" ] || exit 0
|
|
||||||
|
|
||||||
ME=`basename $0`
|
|
||||||
[ "$$" == "`pidof -x $ME`" ] || {
|
|
||||||
[[ "`/usr/bin/tty`" != "not a tty" ]] && echo "Warning: $ME script already running; exiting."
|
|
||||||
exit 0
|
|
||||||
}
|
|
||||||
|
|
||||||
PIDFILE=/run/autodist/autoport.pid
|
|
||||||
HOUR=`date +%H`
|
|
||||||
[ "`uname -m`" = "x86_64" ] && HOST_IS_X86_64=1
|
|
||||||
|
|
||||||
function pid_check() {
|
|
||||||
|
|
||||||
[ -e $PIDFILE ] && PIDCHECK=`cat $PIDFILE`
|
|
||||||
|
|
||||||
[ "$PIDCHECK" -a -e /proc/$PIDCHECK ] && {
|
|
||||||
echo "Error: an autodist process is already running; exiting for safety."
|
|
||||||
exit 0
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pid_check
|
|
||||||
|
|
||||||
for i in `seq 0 ${#AUTOPORT_ARCH[*]}`; do
|
|
||||||
[ "${AUTOPORT_ARCH[$i]}" ] || continue
|
|
||||||
[ "${AUTOPORT_DISABLE[$i]}" -a "${AUTOPORT_DISABLE[$i]}" != "0" ] && continue
|
|
||||||
|
|
||||||
if [ "${AUTOPORT_CHROOT[$i]}" ]; then
|
|
||||||
# disable service restarts
|
|
||||||
mv /var/autoport/${AUTOPORT_CHROOT[$i]}/sbin/service /var/autoport/${AUTOPORT_CHROOT[$i]}/sbin/service.autoport
|
|
||||||
ln -s /bin/true /var/autoport/${AUTOPORT_CHROOT[$i]}/sbin/service
|
|
||||||
# sudo mount -o bind /proc /var/autoport/${AUTOPORT_CHROOT[$i]}/proc
|
|
||||||
[[ "`/usr/bin/tty`" != "not a tty" ]] && echo "Updating packages in ${AUTOPORT_CHROOT[$i]} chroot environment"
|
|
||||||
#echo "= Updating packages in ${AUTOPORT_CHROOT[$i]} chroot environment..." >> $LOGFILE
|
|
||||||
LANG=C /usr/sbin/chroot /var/autoport/${AUTOPORT_CHROOT[$i]} dnf update -y > /dev/null
|
|
||||||
[ "${AUTOPORT_CHROOT_ICECREAM[$i]}" ] && LANG=C /usr/sbin/chroot /var/autoport/${AUTOPORT_CHROOT[$i]} /etc/init.d/icecream start
|
|
||||||
fi
|
|
||||||
|
|
||||||
for r in ${AUTOPORT_REPOSITORIES[$i]}; do
|
|
||||||
|
|
||||||
if [ "$HOST_IS_X86_64" -a "${AUTOPORT_ARCH[$i]}" != "x86_64" ]; then
|
|
||||||
CMD_PREFIX=linux32
|
|
||||||
else
|
|
||||||
CMD_PREFIX=
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "${AUTOPORT_CHROOT[$i]}" ]; then
|
|
||||||
LOGFILE="/var/autodist/log/autoport-chroot-$r-${AUTOPORT_CHROOT[$i]}.log"
|
|
||||||
LASTLOGFILE="/var/autodist/log/autoport-chroot-$r-${AUTOPORT_CHROOT[$i]}-last.log"
|
|
||||||
elif [ "${AUTOPORT_CROSS[$i]}" ]; then
|
|
||||||
LOGFILE="/var/autodist/log/autoport-cross-$r-${AUTOPORT_CROSS[$i]}.log"
|
|
||||||
LASTLOGFILE="/var/autodist/log/autoport-cross-$r-${AUTOPORT_CROSS[$i]}-last.log"
|
|
||||||
else
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
[ -e $LOGFILE ] && mv $LOGFILE $LASTLOGFILE
|
|
||||||
|
|
||||||
echo "+ Autoport start at `date`" > $LOGFILE
|
|
||||||
echo "============================================" >> $LOGFILE
|
|
||||||
|
|
||||||
if [ "${AUTOPORT_CHROOT[$i]}" ]; then
|
|
||||||
echo "= Working on $r(${AUTOPORT_CHROOT[$i]}) in chroot mode..." >> $LOGFILE
|
|
||||||
[[ "`/usr/bin/tty`" != "not a tty" ]] && echo "Working on $r(${AUTOPORT_CHROOT[$i]}) in chroot mode" >> $LOGFILE
|
|
||||||
$CMD_PREFIX /usr/sbin/chroot /var/autoport/${AUTOPORT_CHROOT[$i]} su -l ${AUTOPORT_CHROOT_USER[$i]} -c "autoport -b -r $r" >> $LOGFILE
|
|
||||||
if [ "${AUTOPORT_CHROOT_USER[$i]}" = "autodist" ]; then
|
|
||||||
cat /var/autoport/${AUTOPORT_CHROOT[$i]}/var/autodist/.autoport/${AUTOPORT_ARCH[$i]}/$r-current.log >> $LOGFILE
|
|
||||||
else
|
|
||||||
cat /var/autoport/${AUTOPORT_CHROOT[$i]}/home/${AUTOPORT_CHROOT_USER[$i]}/.autoport/${AUTOPORT_ARCH[$i]}/$r-current.log >> $LOGFILE
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# if [ "${AUTOPORT_NATIVE[$i]}" ]; then
|
|
||||||
# a=${AUTOPORT_ARCH[$i]}
|
|
||||||
# [[ "`/usr/bin/tty`" != "not a tty" ]] && echo "Updating packages in $a native environment"
|
|
||||||
# echo "= Updating packages in $a native environment..." >> $LOGFILE
|
|
||||||
# LANG=C dnf update -y >> $LOGFILE
|
|
||||||
# echo "= Working on $r($a) in native mode" >> $LOGFILE
|
|
||||||
# su -l autodist -c "autoport -b -r $r" >> $LOGFILE
|
|
||||||
# cat /var/autodist/.autoport/$a/$r-current.log >> $LOGFILE
|
|
||||||
# fi
|
|
||||||
|
|
||||||
if [ "${AUTOPORT_CROSS[$i]}" ]; then
|
|
||||||
[[ "`/usr/bin/tty`" != "not a tty" ]] && echo "Working on $r(${AUTOPORT_CROSS[$i]}) in cross-platform mode"
|
|
||||||
echo "= Working on $r(${AUTOPORT_CROSS[$i]}) in cross-platform mode" >> $LOGFILE
|
|
||||||
su -l autodist -c "autoport -b -x ${AUTOPORT_CROSS[$i]} -r $r" >> $LOGFILE
|
|
||||||
cat /var/autodist/.autoport/${AUTOPORT_CROSS[$i]}/$r-current.log >> $LOGFILE
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "- Autoport end at `date`" >> $LOGFILE
|
|
||||||
echo "============================================" >> $LOGFILE
|
|
||||||
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ "${AUTOPORT_CHROOT[$i]}" ]; then
|
|
||||||
mv /var/autoport/${AUTOPORT_CHROOT[$i]}/sbin/service.autoport /var/autoport/${AUTOPORT_CHROOT[$i]}/sbin/service
|
|
||||||
[ "${AUTOPORT_CHROOT_ICECREAM[$i]}" ] && LANG=C /usr/sbin/chroot /var/autoport/${AUTOPORT_CHROOT[$i]} /etc/init.d/icecream stop
|
|
||||||
fi
|
|
||||||
|
|
||||||
done
|
|
Loading…
Reference in New Issue
Block a user