85 lines
2.6 KiB
Bash
85 lines
2.6 KiB
Bash
|
#!/bin/sh
|
||
|
|
||
|
RSYSLOGD_CONF="$(dirname $0)/rsyslog.jessie/rsyslog.conf"
|
||
|
RSYSLOGD_FILE="/etc/rsyslog.conf"
|
||
|
RSYSLOGD_SYSLOG_CONF="$(dirname $0)/rsyslog.jessie/99syslog.conf"
|
||
|
RSYSLOGD_SYSLOG_FILE="/etc/rsyslog.d/99syslog.conf"
|
||
|
|
||
|
LOGROTATE_CONF="$(dirname $0)/logrotate.jessie/logrotate.conf"
|
||
|
LOGROTATE_FILE="/etc/logrotate.conf"
|
||
|
LOGROTATE_SYSLOG_CONF="$(dirname $0)/logrotate.jessie/rsyslog"
|
||
|
LOGROTATE_SYSLOG_FILE="/etc/logrotate.d/rsyslog"
|
||
|
LOGROTATE_APTITUDE_CONF="$(dirname $0)/logrotate.jessie/aptitude"
|
||
|
LOGROTATE_APTITUDE_FILE="/etc/logrotate.d/aptitude"
|
||
|
LOGROTATE_DPKG_CONF="$(dirname $0)/logrotate.jessie/dpkg"
|
||
|
LOGROTATE_DPKG_FILE="/etc/logrotate.d/dpkg"
|
||
|
|
||
|
### Rsyslog ###
|
||
|
|
||
|
# Install new Rsyslog configuration
|
||
|
if [ -f "${RSYSLOGD_FILE}" ]; then
|
||
|
cp "${RSYSLOGD_CONF}" "${RSYSLOGD_FILE}"
|
||
|
fi
|
||
|
cp "${RSYSLOGD_SYSLOG_CONF}" "${RSYSLOGD_SYSLOG_FILE}"
|
||
|
|
||
|
# Remove old log files
|
||
|
## Kernel log files
|
||
|
rm -f /var/log/kern.log
|
||
|
## Authentication log files
|
||
|
rm -f /var/log/user.log /var/log/auth.log
|
||
|
## Mail log files
|
||
|
rm -f /var/log/mail.err /var/log/mail.info /var/log/mail.log /var/log/mail.warn
|
||
|
## System log files
|
||
|
rm -f /var/log/daemon.log /var/log/syslog /var/log/messages
|
||
|
|
||
|
# Restart Rsyslog service
|
||
|
/etc/init.d/rsyslog restart
|
||
|
|
||
|
### Logrotate {{{
|
||
|
|
||
|
# Install new Logrotate configuration
|
||
|
if [ -f "${LOGROTATE_FILE}" ]; then
|
||
|
cp "${LOGROTATE_CONF}" "${LOGROTATE_FILE}"
|
||
|
fi
|
||
|
cp "${LOGROTATE_SYSLOG_CONF}" "${LOGROTATE_SYSLOG_FILE}"
|
||
|
cp "${LOGROTATE_APTITUDE_CONF}" "${LOGROTATE_APTITUDE_FILE}"
|
||
|
cp "${LOGROTATE_DPKG_CONF}" "${LOGROTATE_DPKG_FILE}"
|
||
|
|
||
|
# Create an archive directory for some log files (aptitude, dpkg,…)
|
||
|
mkdir -p -- /var/log/old_logs
|
||
|
|
||
|
# Create the log directory for journald (Systemd), need the configuration Storage=(auto|persistent)
|
||
|
mkdir -p -- /var/log/journal
|
||
|
### }}}
|
||
|
|
||
|
## Packages {{{
|
||
|
# Ensure to have some basic packages
|
||
|
apt -y install aptitude tmux zsh
|
||
|
|
||
|
# Remove NFS and rpcbind
|
||
|
aptitude -y remove nfs-common rpcbind
|
||
|
|
||
|
### Tasksel {{{
|
||
|
|
||
|
if [ "$(dpkg -l task-french)" ]; then
|
||
|
# Move default wordlist to american before remove all packages
|
||
|
select-default-wordlist --set-default=american
|
||
|
aptitude -y remove tasksel tasksel-data task-english task-french task-ssh-server laptop-detect
|
||
|
|
||
|
# Reinstall useful french doc and move back to french dict
|
||
|
aptitude -y install aspell-fr doc-debian-fr doc-linux-fr-text ifrench-gut manpages-fr manpages-fr-extra wfrench
|
||
|
select-default-wordlist --set-default=".*(F|f)rench.*"
|
||
|
|
||
|
else
|
||
|
aptitude -y remove tasksel tasksel-data task-english task-ssh-server laptop-detect
|
||
|
fi
|
||
|
|
||
|
### }}}
|
||
|
|
||
|
# Ensure to reinstall openssh-server
|
||
|
aptitude -y install openssh-server openssh-sftp-server
|
||
|
|
||
|
## }}}
|
||
|
|
||
|
exit 0
|