Archived
1
0
Fork 0

Check IP before submission

This commit is contained in:
Mercier Pierre-Olivier 2013-09-19 04:52:29 +02:00
parent 188931f0d4
commit 9038f49904
3 changed files with 70 additions and 19 deletions

View file

@ -1,30 +1,58 @@
#! /bin/bash
# Install missing packets
PACKAGES_LIST="libnet-ldap-perl libxml-libxml-perl libgearman-client-perl libmailtools-perl libmail-sendmail-perl libdate-manip-perl"
DEB_PACKAGES_LIST="libnet-ldap-perl libxml-libxml-perl libgearman-client-perl libmailtools-perl libmail-sendmail-perl libdate-manip-perl"
ARCH_PACKAGES_LIST="perl-io-socket-ssl perl-email-simple perl-email-mime perl-term-readkey perl-ldap perl-lwp-protocol-https"
if ! whereis dpkg > /dev/null 2> /dev/null
if [ -f "/etc/debian_version" ]
then
aptitude install dpkg
fi
for PK in $PACKAGES_LIST
do
if ! dpkg -l | grep "^ii" | grep "$PK" > /dev/null 2> /dev/null
if ! whereis dpkg > /dev/null 2> /dev/null
then
aptitude install "$PK"
aptitude install dpkg
fi
done
for PK in $DEB_PACKAGES_LIST
do
if ! dpkg -l | grep "^ii" | grep "$PK" > /dev/null 2> /dev/null
then
aptitude install "$PK"
fi
done
# Add intradmin user if missing
if ! getent passwd | grep "intradmin:" > /dev/null 2> /dev/null
# Add intradmin user if missing
if ! getent passwd | grep "intradmin:" > /dev/null 2> /dev/null
then
useradd --shell /bin/false --uid 942 intradmin &&
mkdir -p /home/intradmin
fi
chown -R intradmin:intradmin /home/intradmin
elif [ -f "/etc/arch-release" ]
then
useradd --shell /bin/false --uid 942 intradmin &&
mkdir -p /home/intradmin
fi
chown -R intradmin:intradmin /home/intradmin
for PK in $ARCH_PACKAGES_LIST
do
if ! pacman -Qi "$PK" > /dev/null 2> /dev/null
then
pacman -S "$PK"
fi
done
elif [ -f "/etc/freebsd-update.conf" ]
then
echo "TODO: FreeBSD"
exit 1;
else
echo "Unknown operating system :("
exit 1;
fi
# Git ?
if egrep '^git:' /etc/passwd > /dev/null
@ -33,4 +61,4 @@ then
chown git /var/log/hooks/
fi
echo "System ready!"
echo "System ready!"

View file

@ -2,6 +2,7 @@
cd $(dirname "$0")
WKS_LIST="apl"
SRV_LIST="moore noyce hamano cpp"
ACTIONS="start stop restart update"
@ -43,6 +44,16 @@ do
echo
done
for WKS in $WKS_LIST
do
echo -e "\e[1;34m>>>\e[0m $ACTION on $WKS"
if [ "$ACTION" == "update" ]
then
ssh root@$SRV "make -C liblerdorf update upgrade"
fi
echo
done
cat "$LOG"
exit $FAIL
exit $FAIL