116 lines
2.6 KiB
Bash
Executable File
116 lines
2.6 KiB
Bash
Executable File
#! /bin/bash
|
|
|
|
# Install missing packages
|
|
DEB_PACKAGES_LIST="screen libnet-ldap-perl libxml-libxml-perl libgearman-client-perl libmailtools-perl libdatetime-format-iso8601-perl libnet-ip-perl libsys-gamin-perl libdigest-sha-perl libemail-mime-perl libemail-sender-perl"
|
|
ARCH_PACKAGES_LIST="screen perl-io-socket-ssl perl-email-mime perl-term-readkey perl-ldap perl-lwp-protocol-https perl-datetime-format-iso8601 perl-net-ip" # aur/perl-sys-gamin
|
|
GENTOO_PACKAGES_LIST="app-misc/screen dev-perl/IO-Socket-SSL dev-perl/Email-MIME dev-perl/TermReadKey dev-perl/perl-ldap dev-perl/LWP-Protocol-https dev-perl/DateTime-Format-ISO8601 dev-perl/Net-IP dev-perl/Email-Sender"
|
|
FBSD_PACKAGES_LIST="screen p5-IO-Socket-SSL p5-Email-MIME p5-Term-ANSIColor p5-Term-ReadKey p5-LWP-Protocol-https p5-DateTime-Format-ISO8601 p5-Net-IP p5-Sys-Gamin"
|
|
|
|
KERNEL=`uname -s`
|
|
|
|
if [ "$KERNEL" = "FreeBSD" ]
|
|
then
|
|
|
|
for PK in `echo $FBSD_PACKAGES_LIST`
|
|
do
|
|
if ! pkg info "$PK" > /dev/null 2> /dev/null
|
|
then
|
|
if ! PACKAGESITE="http://canon.acu.epita.fr/repo-lab" pkg install "$PK"
|
|
then
|
|
echo "Error during installation of $PK"
|
|
exit 1
|
|
fi
|
|
fi
|
|
done
|
|
|
|
if ! getent passwd | grep "intradmin:" > /dev/null 2> /dev/null
|
|
then
|
|
pw useradd intradmin -u 942 -d /data -s /bin/false
|
|
fi
|
|
|
|
elif [ "$KERNEL" = "Linux" ]
|
|
then
|
|
|
|
if [ -f "/etc/debian_version" ]
|
|
then
|
|
|
|
if ! whereis dpkg > /dev/null 2> /dev/null
|
|
then
|
|
if ! aptitude install dpkg
|
|
then
|
|
echo "Error during installation of $PK"
|
|
exit 1
|
|
fi
|
|
fi
|
|
|
|
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
|
|
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
|
|
|
|
for PK in $ARCH_PACKAGES_LIST
|
|
do
|
|
if ! pacman -Qi "$PK" > /dev/null 2> /dev/null
|
|
then
|
|
if ! pacman -S "$PK"
|
|
then
|
|
echo "Error during installation of $PK"
|
|
exit 1
|
|
fi
|
|
fi
|
|
done
|
|
|
|
elif [ -f "/etc/gentoo-release" ]
|
|
then
|
|
|
|
for PK in $GENTOO_PACKAGES_LIST
|
|
do
|
|
if ! equery list "$PK" > /dev/null 2> /dev/null
|
|
then
|
|
if ! emerge "$PK"
|
|
then
|
|
echo "Error during installation of $PK"
|
|
exit 1
|
|
fi
|
|
fi
|
|
done
|
|
|
|
else
|
|
|
|
echo "Unsupported GNU/Linux distribution :("
|
|
exit 1;
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
echo "Unsupported operating system :("
|
|
exit 1;
|
|
|
|
fi
|
|
|
|
# Git ?
|
|
if egrep '^git:' /etc/passwd > /dev/null
|
|
then
|
|
mkdir -p /var/log/hooks/ &&
|
|
chown git /var/log/hooks/
|
|
fi
|
|
|
|
echo "System ready!"
|