#! /bin/bash # Install missing packages DEB_PACKAGES_LIST="screen libnet-ldap-perl libxml-libxml-perl libgearman-client-perl libmailtools-perl libmail-sendmail-perl libdatetime-format-iso8601-perl libnet-ip-perl" ARCH_PACKAGES_LIST="screen perl-io-socket-ssl perl-email-simple perl-email-mime perl-term-readkey perl-ldap perl-lwp-protocol-https perl-datetime-format-iso8601 perl-net-ip" FBSD_PACKAGES_LIST="screen p5-IO-Socket-SSL p5-Email-Simple p5-Email-MIME p5-Term-ANSIColor p5-Term-ReadKey p5-LWP-Protocol-https p5-DateTime-Format-ISO8601 p5-Net-IP" KERNEL=`uname -s` if [ "$KERNEL" = "FreeBSD" ] then for PK in $FBSD_PACKAGES_LIST do if ! pkg info "$PK" > /dev/null 2> /dev/null then PACKAGESITE="http://canon.acu.epita.fr/repo-lab" pkg install "$PK" fi done elif [ "$KERNEL" = "Linux" ] then if [ -f "/etc/debian_version" ] then if ! whereis dpkg > /dev/null 2> /dev/null then aptitude install dpkg 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 pacman -S "$PK" fi done else echo "Unknown distribution :(" exit 1; fi else echo "Unknown 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!"