79 lines
2.9 KiB
Bash
Executable File
79 lines
2.9 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
#
|
|
# BSD 3-Clause License
|
|
#
|
|
# Copyright (c) 2018, Alban Vidal <alban.vidal@zordhak.fr>
|
|
# All rights reserved.
|
|
#
|
|
# Redistribution and use in source and binary forms, with or without
|
|
# modification, are permitted provided that the following conditions are met:
|
|
#
|
|
# * Redistributions of source code must retain the above copyright notice, this
|
|
# list of conditions and the following disclaimer.
|
|
#
|
|
# * Redistributions in binary form must reproduce the above copyright notice,
|
|
# this list of conditions and the following disclaimer in the documentation
|
|
# and/or other materials provided with the distribution.
|
|
#
|
|
# * Neither the name of the copyright holder nor the names of its
|
|
# contributors may be used to endorse or promote products derived from
|
|
# this software without specific prior written permission.
|
|
#
|
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
################################################################################
|
|
|
|
# Install the packages
|
|
apt-get -y install -y git tig bash-completion unattended-upgrades apt-listchanges logrotate
|
|
|
|
# Configure auto updates
|
|
sed -i \
|
|
-e 's#^//Unattended-Upgrade::Mail .*#Unattended-Upgrade::Mail "unattended@zordhak.fr";#' \
|
|
-e 's#^//Unattended-Upgrade::MailOnlyOnError .*#Unattended-Upgrade::MailOnlyOnError "true";#' \
|
|
/etc/apt/apt.conf.d/50unattended-upgrades
|
|
|
|
# Git global username and email
|
|
read -p "Git username: " GIT_USERNAME
|
|
read -p "Git email: " GIT_EMAIL
|
|
|
|
git config --global user.name "$GIT_USERNAME"
|
|
git config --global user.email "$GIT_EMAIL"
|
|
|
|
## Symbolic links
|
|
# Bashrc
|
|
ln -sf /srv/git/basic_config_debian/root/.bashrc /root/
|
|
# Profile
|
|
ln -sf /srv/git/basic_config_debian/root/.profile /root/
|
|
mkdir -p /root/.profile.d
|
|
ln -sf /srv/git/basic_config_debian/root/.profile.d/00_connexion_info.conf /root/.profile.d/
|
|
# vimrc
|
|
ln -sf /srv/git/basic_config_debian/root/.vimrc /root/
|
|
|
|
## Tune logrotate
|
|
# Fix logrotate bug
|
|
cat << EOF > /etc/cron.daily/logrotate
|
|
#!/bin/sh
|
|
test -x /usr/sbin/logrotate || exit 0
|
|
/usr/sbin/logrotate -f /etc/logrotate.conf
|
|
EOF
|
|
# Disable delaycompress
|
|
sed -i 's/.*delaycompress/#&/' /etc/logrotate.d/*
|
|
|
|
# Disable IPv6
|
|
cat << EOF > /etc/sysctl.d/98-disable-ipv6.conf
|
|
# Disable ipv6 on all connexion
|
|
net.ipv6.conf.all.disable_ipv6 = 1
|
|
EOF
|
|
sysctl -p
|
|
|