84 lines
		
	
	
		
			2.2 KiB
		
	
	
	
		
			Bash
		
	
	
	
	
	
			
		
		
	
	
			84 lines
		
	
	
		
			2.2 KiB
		
	
	
	
		
			Bash
		
	
	
	
	
	
| #!/bin/bash
 | |
| 
 | |
| #######
 | |
| ### Copy customization files to their proper locations after backing up
 | |
| ### original files
 | |
| #######
 | |
| 
 | |
| 
 | |
| # colour definitions
 | |
| norm="\e[0m"
 | |
| yellow="\e[93m"
 | |
| cyan="\e[96m"
 | |
| mag="\e[95m"
 | |
| err="\e[1;31m"
 | |
| ok="\e[1;32m"
 | |
| 
 | |
| 
 | |
| ### Verify this script is running as root, otherwise exit with notification
 | |
| if [ $(id -u) -ne 0 ]; then
 | |
| echo -e "\n${err}This script MUST be run as ROOT. Exiting${norm}"
 | |
| exit 1
 | |
| fi
 | |
| 
 | |
| 
 | |
| ### Let user know what's happening
 | |
| echo -e "\n${norm}This script will copy TEMPLATE files to various locations in order to customize"
 | |
| echo "your system. Backups will be created in-place with the extension '.original'"
 | |
| echo -e "\n${yellow}Please note: It's still up to you to customize the template files with settings"
 | |
| echo "appropriate to your environment!"
 | |
| 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
 | |
| echo -e "${mag}---------------------${norm}"
 | |
| 
 | |
| ## Copy root's .bashrc
 | |
| echo -e "\ncopying .bashrc to /root..."
 | |
| # backup
 | |
| cp -f /root/.bashrc /root/.bashrc.original
 | |
| # copy new
 | |
| cp -f config/root/.bashrc /root/.bashrc
 | |
| echo "...done"
 | |
| 
 | |
| ## Copy profile template files and skel files
 | |
| echo -e "\ncopying default bash profile files..."
 | |
| # backup
 | |
| cp -f /etc/profile /etc/profile.original
 | |
| cp -f /etc/bash.bashrc /etc/bash.bashrc.original
 | |
| cp -f /etc/skel/.bashrc /etc/skel/.bashrc.original
 | |
| # copy new
 | |
| cp -f config/etc/profile /etc/profile
 | |
| cp -f config/etc/bash.bashrc /etc/bash.bashrc
 | |
| cp -f config/etc/skel/.bashrc /etc/skel/.bashrc
 | |
| echo "...done"
 | |
| 
 | |
| ## copy nano settings
 | |
| echo -e "\ncopying nano default settings..."
 | |
| # backup
 | |
| cp -f /etc/nanorc /etc/nanorc.original
 | |
| # copy new
 | |
| 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
 | |
| 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
 | |
| cp -f config/etc/ssh/sshd_config /etc/ssh/sshd_config
 | |
| echo "...done"
 | |
| 
 | |
| ### Exit gracefully
 | |
| echo -e "\n${ok}All done!${norm}\n"
 | |
| 
 | |
| exit 0
 |