DebianConfigs/customize.sh

95 lines
2.5 KiB
Bash
Raw Normal View History

#!/bin/bash
#######
### Copy customization files to their proper locations after backing up
### original files
#######
2019-01-09 00:55:38 -07:00
# colour definitions
norm="\e[0m"
yellow="\e[93m"
cyan="\e[96m"
mag="\e[95m"
err="\e[1;31m"
ok="\e[1;32m"
2019-01-09 00:59:51 -07:00
### verify this script is running as root, otherwise exit with notification
if [ $(id -u) -ne 0 ]; then
2019-01-09 00:59:51 -07:00
echo -e "\n${err}This script MUST be run as ROOT. Exiting${norm}"
exit 1
fi
2019-01-09 00:59:51 -07:00
### let user know what's happening
2019-01-09 00:59:51 -07:00
echo -e "\n${norm}This script will copy TEMPLATE files to various locations in order to customize"
2019-01-09 00:51:23 -07:00
echo "your system. Backups will be created in-place with the extension '.original'"
2019-01-09 00:59:51 -07:00
echo -e "\n${yellow}Please note: It's still up to you to customize the template files with settings"
2019-01-09 00:51:23 -07:00
echo "appropriate to your environment!"
2019-01-09 00:59:51 -07:00
echo -e "\n${cyan}Details about template files are in the readme.md files within each directory"
echo -e "in this archive.${norm}\n"
### copy files to proper locations
2019-01-09 01:00:16 -07:00
echo -e "${mag}---------------------${norm}"
2019-01-09 01:02:21 -07:00
echo "(please note any errors below)"
2019-01-09 01:07:39 -07:00
## copy clean .bashrc for root user
echo -e "copying ${yellow}.bashrc${norm} to ${yellow}/root${norm}"
# backup
cp -f /root/.bashrc /root/.bashrc.original
# copy new
2019-01-02 00:14:53 -07:00
cp -f config/root/.bashrc /root/.bashrc
## copy profile template file
echo -e "copying ${yellow}profile${norm} to ${yellow}/etc/profile${norm}"
# backup
cp -f /etc/profile /etc/profile.original
# copy new
2019-01-02 00:14:53 -07:00
cp -f config/etc/profile /etc/profile
## copy updated bash.bashrc
echo -e "copying ${yellow}bash.bashrc${norm} to ${yellow}/etc/bash.bashrc${norm}"
# backup
cp -f /etc/bash.bashrc /etc/bash.bashrc.original
# copy new
2019-01-02 00:14:53 -07:00
cp -f config/etc/bash.bashrc /etc/bash.bashrc
## copy updated skel .bashrc
echo -e "copying ${yellow}.bashrc${norm} to ${yellow}/etc/skel/.bashrc${norm}"
# backup
cp -f /etc/skel/.bashrc /etc/skel/.bashrc.original
# copy new
2019-01-02 00:14:53 -07:00
cp -f config/etc/skel/.bashrc /etc/skel/.bashrc
## copy nano settings
echo -e "\ncopying nano default settings..."
# backup
cp -f /etc/nanorc /etc/nanorc.original
# copy new
2019-01-02 00:14:53 -07:00
cp -f config/etc/nanorc /etc/nanorc
echo "...done"
## copy timesync
echo -e "\ncopying timesync configuration..."
# backup
cp -f /etc/systemd/timesyncd.conf /etc/systemd/timesyncd.conf.original
# copy new
2019-01-02 00:14:53 -07:00
cp -f config/etc/systemd/timesyncd.conf /etc/systemd/timesyncd.conf
echo "...done"
## copy sshd configuration
echo -e "\ncopying sshd configuration..."
# backup
cp -f /etc/ssh/sshd_config /etc/ssh/sshd_config.original
# copy new
2019-01-02 00:14:53 -07:00
cp -f config/etc/ssh/sshd_config /etc/ssh/sshd_config
echo "...done"
2019-01-09 00:59:51 -07:00
### Exit gracefully
2019-01-09 00:59:51 -07:00
echo -e "\n${ok}All done!${norm}\n"
exit 0