Archived
1
0
Fork 0
This repository has been archived on 2021-10-08. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
ACU/commands/first-install.sh
2013-09-28 11:16:14 +02:00

82 lines
1.7 KiB
Bash
Executable file

#! /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!"