#!/bin/sh # This script picks up scheduled configuration information for this machine # and stores it all in $BASE_DIR. [-d] parameter deletes and # remakes sub-directories as needed in $BASE_DIR. Files in $BASE_DIR # not affected but those generated here are overwritten. As the writers # system /home directory is mounted from a different drive than /, keeping # $BASE_DIR in a regular users account saves the data over system installs. # # Must be run as superuser as many of the config files have restrictive # permissions set. The resulting $BASE_DIR is owned by $CONFIG_USER. # # Copyright (c) 2008-2013 David R. Forrest (Forrest) # # Permission to use, copy, modify, and distribute this material # for any purpose and without fee is hereby granted, provided # that the above copyright notice and this permission notice # appear in all copies, and that the name of Forrest not be # used in advertising or publicity pertaining to this # material without the specific, prior written permission # of an authorized representative of Forrest. FORREST # MAKES NO REPRESENTATIONS ABOUT THE ACCURACY OR SUITABILITY # OF THIS MATERIAL FOR ANY PURPOSE. IT IS PROVIDED "AS IS", # WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. # # Revised 06/04/10 for F13 installation # Revised 01/24/11 for F14 # Revised 08/22/11 technical structure of DIRs # Revised 01/21/13 for CentOS6 # Revised 06/15/14 for CentOS65June2014 # Revised 10/25/14 for iptables DIR updated # Revised 11/25/14 to document windxp VM in KVM # Be sure to set user name CONFIG_USER and Base Directory below CONFIG_USER="drf" # Assume we are in CentOS65June2014 else Unknown Fedora=Unknown $(/bin/uname -r |grep el6 >/dev/null) && Fedora=CentOS65June2014 BASE_DIR="/home/drf/Desktop/SystemDocumentation/$Fedora" # Subdirectories to the $BASE_DIR are script created by a statement starting in column 1 # formatted as: DIR=$BASE_DIR/subdirectory_name # Script path used in creating this config (actually must be the real root - no sudo) SCRIPTPATH='/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin' #root #SCRIPTPATH='/usr/lib64/qt-3.3/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/drf/bin' #user drf # OK must be really su - LOCAL_CONFIG_NOTES='This white box system bypasses many of the CentOS configuration files normally included as it has evolved over several years from earlier installations. As such, be advised to carefully check that configuration information that may be provided by Fedora is actually used. Sorry about that. -drf 4/9/08' # Sanity checks test $UID != 0 && { echo "Must be super user!" ; exit; } [ $SCRIPTPATH == $PATH ] || { echo -e "\n\nActual Enviornment Path: $PATH\nScript Path: $SCRIPTPATH\n\n Active environment path does not match original script creation (SCRIPTPATH) - Confirm/reset it. Running dir?" ; } test -z $BASE_DIR && { echo "Must set base directory in script (BASE_DIR)" ; exit; } test -z $CONFIG_USER && { echo "Must set a target user for these files" ; exit; } test ! -d $BASE_DIR && { echo "Base Directory ($BASE_DIR) is not a directory" ; exit; } test ! -w $BASE_DIR && { echo "Base Directory ($BASE_DIR) is not writable" ; exit; } # Check how we are to run while getopts ":dbh" opt; do case $opt in d) CLEAN_OUT_DIRS="yes" ;; b) [ -f $BASE_DIR/bootdmesg ] && mv $BASE_DIR/bootdmesg $BASE_DIR/bootdmesg.bak date > $BASE_DIR/bootdmesg echo >> $BASE_DIR/bootdmesg dmesg >> $BASE_DIR/bootdmesg chown $CONFIG_USER.$CONFIG_USER $BASE_DIR/bootdmesg exit 0 ;; *|h ) echo -e "\n Usage: ${0##*/} [-d] [-b] [h]" echo " -d Clean out sub-directories before rebuilding" echo " -b Update boot dmesg output only" echo " -h This help" echo -e " Note: This script requires configuration modification \n" exit 1 ;; esac done # Establish directories # Builds the DIRS to be found in this script. Must start in column 1 and look like the DIR=$BASE_DIR/boot below DIRS=$(awk '/^DIR\=\$BASE_DIR\// { print $1 }' $0 |sed 's/DIR=$BASE_DIR\/\([:alpha:]*\)/\1/g') for directoryfound in $DIRS; do [ -n "$CLEAN_OUT_DIRS" ] && \ { rm -r $BASE_DIR/$directoryfound > /dev/null 2>&1 echo "Removing contents of $BASE_DIR/$directoryfound" } mkdir -p $BASE_DIR/$directoryfound &>/dev/null # create found directory if missing. done DIR=$BASE_DIR/boot # bootup drive, lvm, and iptables at boot { # do all this in a block (faster than a subshell) # this is data collected at boot time by /usr/local/bin/my.rc.local with # printf "When booted as:$(/bin/uname -a)\n$(/sbin/hdparm -i /dev/sd[a-f] | grep -i '\(serial\|dev\)')\n\n" [ -f /usr/local/sbin/as_booted_drive_info.txt ] && rsync -a /usr/local/sbin/as_booted_drive_info.txt $DIR/AsBooted rsync -a /boot/grub/grub.conf $DIR/ rm -f /usr/local/bin/RESULTS.txt &>/dev/null [ -f /var/log/boot.log ] && rsync -a /var/log/boot.log $DIR/boot.log-$(date +%Y%m%d) [ -x /usr/sbin/dmidecode ] && /usr/sbin/dmidecode > $DIR/dmidecode-$(date +%Y%m%d) # /usr/local/bin/boot_info_script032.sh > /dev/null # rsync -a /usr/local/bin/RESULTS.txt $DIR/ # rm -f /usr/local/bin/RESULTS.txt &>/dev/null # /usr/local/sbin/bootinfo > $DIR/bootinfo.out /bin/echo -e "Services running as of $(date +%F)\n\n" > $DIR/SnapshopOfServices /sbin/service --status-all >> $DIR/SnapshopOfServices rsync -aRu /etc/lvm/ $DIR/ rsync -aRu /etc/smartd.conf/ $DIR/ # [ -f /tmp/iptables-setup ] && rsync -a /tmp/iptables-setup $DIR/ } DIR=$BASE_DIR/CUPS # Printing setup { echo "Files in this directory sourced from /etc/cups" >$DIR/README rsync -a /etc/cups/ $DIR/ rsync -a /etc/printcap $DIR } DIR=$BASE_DIR/KVM # Virtual domains [ -d /etc/libvirt ] && \ { rsync -aRu /etc/libvirt/ $DIR/ # Very large (30GB) image files in /var/lib/libvirt/images/* Dump as xml per following: /usr/bin/virsh dumpxml windxp >$DIR/windxp.xml echo -e "This file sourced from /etc/sysconfig/libvirt-guests\n" > $DIR/libvirt-guests cat /etc/sysconfig/libvirt-guests >> $DIR/libvirt-guests rsync -a /etc/Machines $DIR/Machines } DIR=$BASE_DIR/Crontabs # system existing crontabs # Selected users in WORD lists only their existing crontabs. # Default -- lists all users existing crontabs. # WORD="" [ -z "$WORD" ] && WORD="`awk -F\":\" '{ printf \"%s \",$1 }' /etc/passwd`" rm -r $DIR > /dev/null 2>&1 mkdir -p $DIR >/dev/null 2>&1 { for LISTED in $WORD; do date > $DIR/crontab.$LISTED echo >> $DIR/crontab.$LISTED /usr/bin/crontab -u $LISTED -l >> $DIR/crontab.$LISTED 2>&1 grep "no crontab for" $DIR/crontab.$LISTED > /dev/null 2>&1 && \ rm $DIR/crontab.$LISTED done } # DIR=$BASE_DIR/hylafax # hylafax+ from http://hylafax.sourceforge.net/ # [ -f /var/spool/hylafax/etc/config ] && \ # { # rsync -a /var/spool/hylafax/etc/config $DIR # rsync -a /var/spool/hylafax/etc/config.ttyS1 $DIR # rsync -a /usr/local/lib/fax/sendfax.conf $DIR # rsync -a /var/spool/hylafax/etc/FaxNotify $DIR # rsync -a /var/spool/hylafax/etc/FaxDispatch $DIR # rsync -a /var/spool/hylafax/bin/jobcontrol $DIR || mail -s "/var/spool/hylafax/bin/jobcontrol is missing" root # echo -e "# From /etc/event.d/ttyS1 $(date)\n\n" > $DIR/faxgetty-init # cat /etc/event.d/ttyS1 >> $DIR/faxgetty-init # echo -e "# From /usr/local/lib/fax/typerules $(date) \n\n" >$DIR/typerules # cat /usr/local/lib/fax/typerules >>$DIR/typerules # echo ' # # Do not forget: edit-faxcover will edit the default cover page # # faxcover.ps default is in /usr/local/lib/fax/faxcover.ps' > $DIR/edit-faxcover # rsync -a /usr/local/lib/fax/faxcover.ps $DIR # rsync -a /etc/event.d/ttyS1 $DIR # rsync -a /home/drf/Desktop/SystemDocumentation/hylafax_error_messages.pdf $DIR # } DIR=$BASE_DIR/mailcap # Necessary for alpine http://sourceforge.net/projects/re-alpine/ { cp /etc/mailcap $DIR cp /home/drf/.mailcap $DIR/drf.mailcap cp -u /etc/mime.types $DIR } DIR=$BASE_DIR/DNS # From ISC includes dhcpd http://www.isc.org/ { # /usr/bin/jwhois -h whois.gandi.net maplepark.com > $DIR/whoisMP # cp -u /etc/named.conf $DIR # /usr/local/sbin/named-checkconf -p >/var/named/named.conf.canonical ||\ # echo -e "\nConversion failed, as will named if attempted" &>>/var/named/named.conf.canonical # /bin/sed 's/secret \".*\"/secret "Obscured"/g' /var/named/named.conf.canonical > /var/named/named.conf.canonical.obscured # cp -u /var/named/named.conf.canonical.obscured $DIR/named.conf.canonical # rsync -a --copy-links /var/named/* $DIR # [ -f /etc/dhcpd.conf ] && ( cp -u /etc/dhcpd.conf $DIR ) # cp -u /etc/sysconfig/dhcpd $DIR/etc-sysconfig-dhcpd # cp -u /usr/local/sbin/seen* $DIR/ # [ -f /var/db/dhcpd.leases ] && ( cp -u /var/db/dhcpd.leases $DIR ) # cp -u /usr/local/sbin/renew-default-route $DIR # [ -f /etc/update-keys ] && ( cp -u /etc/update-keys $DIR ) # [ -f /etc/dns-slaves ] && ( cp -u /etc/dns-slaves $DIR ) # cp -u /etc/radvd.conf $DIR # cp -u /etc/nsswitch.conf $DIR # [ -f /etc/rndc.conf ] && ( cp -u /etc/rndc.conf $DIR ) # cp -u /etc/hostslocal $DIR # cp -u /var/lib/dhclient/dhclient-eth0.leases $DIR # cp -u /etc/resolv.conf $DIR # [ -f /etc/resolv.conf.static ] && ( cp -u /etc/resolv.conf.static $DIR ) cp -u /usr/local/bin/buildblackhole $DIR # canonicalization # named-checkzone -D -o $DIR/maplepark.com.signed.canonical maplepark.com \ # /var/named/drf/external/maplepark.com.signed &> /tmp/$$junk # echo -e "\n;;*** OUTPUT FROM $0 RUN DATED $(date +%F) ***" >>$DIR/maplepark.com.signed.canonical # cat /tmp/$$junk >> $DIR/maplepark.com.signed.canonical; rm -f /tmp/$$junk # named-checkzone -D -o $DIR/maplepark.com.Internal.canonical maplepark.com \ # /var/named/drf/internal/maplepark.com &> /tmp/$$junk # echo -e "\n;;*** OUTPUT FROM $0 RUN DATED $(date +%F) ***" >>$DIR/maplepark.com.Internal.canonical # cat /tmp/$$junk >> $DIR/maplepark.com.Internal.canonical; rm -f /tmp/$$junk # named-checkzone -D -o $DIR/tunneled.ip6.arpa.canonical 0.4.6.8.f.0.0.0.8.7.9.4.1.0.0.2.ip6.arpa \ # /var/named/drf/internal/tunneled.ip6.arpa &> /tmp/$$junk # echckets transmitted, 2 received, 0% packet loss, time 1060ms # echo -e "\n;;*** OUTPUT FROM $0 RUN DATED $(date +%F) ***" >>$DIR/tunneled.ip6.arpa.canonical # cat /tmp/$$junk >> $DIR/maplepark.com.Internal.canonical # rm -f /tmp/$$junk # [ -f /etc/dns-slaves ] && ( rsync -a /etc/dns-slaves $DIR/etc-dns-slaves ) # [ $(pgrep -o named) ] && ( /bin/echo -e "Running as: $( cat /proc/$(pgrep -o named)/cmdline) $(date) \n " >$DIR/named_process_limits ) # [ $(pgrep -o named) ] && ( /bin/cat /proc/$(pgrep -o named)/limits >> $DIR/named_process_limits ) ### Optional patch follows echo '/etc/rc.d/init.d/named INIT PATCH (Optional): NOTE: Failure to apply patch will result in the CentOS binary /usr/sbin/named running in lieu of the /usr/local/sbin version. Because we usually use a custom bind from ISC and this Fedora system has a fedora named installed that uses the full system V init scripts that rely on /etc/rc.d/init.d/named scripts to stop, start, or restart, it is necessary to edit the /etc/rc.d/init.d/named script to properly set up limits, the binary, and the working directory upon system upgrades as yum bind updates may overwrite our patch and render it ephemeral: +++ [ -x /usr/local/sbin/"$named" ] || exit 5 (near line 105) --- [ -x /usr/sbin/"$named" ] || exit 5 if [ -x /usr/sbin/named-checkconf ] && [ -x /usr/sbin/named-checkzone ] && /usr/sbin/named-checkconf $ckcf_options ${named_conf} >/dev/null 2>&1; then +++ ulimit -u 4096 ## DRF (near line 165) +++ chown -hR named:named /var/named ## DRF --- daemon --pidfile "$ROOTDIR/$PIDFILE" /usr/sbin/"$named" -u named ${OPTIONS}; +++ daemon --pidfile "$ROOTDIR/$PIDFILE" /usr/local/sbin/"$named" -u named ${OPTIONS}; ## DRF RETVAL=$? if [ $RETVAL -eq 0 ]; then Also, under rhstatus(), I sometimes add near line 240: cat "/proc/$(pgrep -o named)/limits" to get system limits added to the "service named status" report. # DRF 5/7/2010 END INIT PATCH ' >$DIR/README_named_script_changes } DIR=$BASE_DIR/iptables # Firewalls - IPv4 and IPv6 { /bin/cp -u /usr/local/sbin/setup_iptables $DIR date > $DIR/iptables-list /sbin/iptables -L -v --line-numbers -n >> $DIR/iptables-list echo "" >>$DIR/iptables-list /sbin/iptables -t nat -L -v --line-numbers -n >> $DIR/iptables-list echo -e "\nEND of iptables list\n" >>$DIR/iptables-list date > $DIR/ip6tables-list /sbin/ip6tables -L -v --line-numbers -n >> $DIR/ip6tables-list echo -e "\nEND of ip6tables list\n" >> $DIR/ip6tables-list date > $DIR/ebtables-list [ -x /sbin/ebtables ] && /sbin/ebtables -Ln >> $DIR/ebtables-list echo -e "\nEND of ebtables list\n" >>$DIR/ebtables-list /bin/cp -u /etc/sysconfig/iptables $DIR/iptables-DEFAULT /bin/cp -u /etc/sysconfig/ip6tables $DIR/ip6tables-DEFAULT echo "$LOCAL_CONFIG_NOTES" >$DIR/README echo ' Bridge considerations: 1. Since this machine is also acting as router for all attached machines (V4/V6) some of which are virtual, we need to attach the virtual interface to a physical one. We have chosen eth1 to be configured as the bridge "br0". This necessitated a number of NON-STANDARD configurations as shown in the SysConfigs folder. See particularily ifcfg-eth1, ifcfg-br0, route6-br0 in network-scripts. 2. Resetting IPv6 routes for maplepark.com: The routine /usr/local/sbin/resetroutes is necessary because we use fixed ipV6 for some hosts and also rely on autoconf for others (visitors) and CentOS6.4 does not as yet fully establish the mixed use (both router w/ipV4 NAT and ipV6 workstation) of this machine and therefore radvd will not restart if forwarding is not enabled while V6 autoconf will be disabled if it is. Normal booting allows the proper sequencing but just doing the standard 6.4 "service network restart" makes radavd lose multicast communications and deletes our local static ipV6 route. This routine is called in /bin/service network restart (/etc/rc.d/init.d/network - end of start section) by an annoying kludge that breaks on updates. 3. This is the necessary kludge # Added for maplepark.com by DRF to restart radvd and confirm forwarding if [ -x /usr/local/sbin/resetroutes ]; then /usr/local/sbin/resetroutes fi ;; -- DRF 7 JUN 2013 ' >$DIR/BRIDGEWARNINGS echo ' iptables STRATEGEM: 1. Basic firewall setup is per CentOS control and becomes the *-DEFAULT on system startup. Persistent configurations must be made to the file /etc/sysconfig/iptables (or ip6tables). 2. Various system programs control dynamic adjustments to the firewall such as firewall banging control (killit, killit_plugin, dropbad) and port scan control (stopscan_plugin). 3. Copies of the dynamic firewall are stored in this directory as ip(6)tables-list upon running this script. 4. The "setup-iptables" file is a deprecated system developed a dozen years ago that has simply outlived its usefulness. I am currently working within CentOS and adding necessary things to the dynamic configuration. ' >$DIR/STRATEGEM } DIR=$BASE_DIR/SysStartupConfigs # System startup configurations { cp -u /etc/inittab $DIR cp -u /etc/rc.d/rc.local $DIR rsync -a /usr/local/bin/my.rc.local $DIR cp -u /etc/bashrc $DIR/etc.bashrc [ -f /home/drf/.bashrc ] && rsync -u /home/drf/.bashrc $DIR/drf.bashrc [ -f /root/.bashrc ] && rsync -u /root/.bashrc $DIR/root.bashrc cp -u /etc/profile $DIR/etc.profile [ -f /home/drf/.profilerc ] && rsync -u /home/drf/.profilerc $DIR/drf.profilerc [ -f /root/.profilerc ] && rsync -u /root/drf/.profilerc $DIR/root.profilerc rsync -a /etc/profile.d $DIR rsync -u /etc/selinux/config $DIR/etc.selinux.config echo "$LOCAL_CONFIG_NOTES" > $DIR/README /sbin/chkconfig --list > $DIR/chkconfigs rsync -u /etc/rc.d/init.d/* $DIR/init.d/ } DIR=$BASE_DIR/a2ps # ascii to ps print formatting used by alpine mailer [ -f /etc/a2ps.cfg ] && \ { cp -u /etc/a2ps-site.cfg $DIR cp -u /etc/a2ps.cfg $DIR } DIR=$BASE_DIR/syslog # System logs and rotation { cp -u /etc/rsyslog.conf $DIR cp -u /etc/logrotate.conf $DIR rsync -a /etc/logrotate.d $DIR/ echo "Files to be rotated are configured in logrotate.d/syslog" > $DIR/README } DIR=$BASE_DIR/killit # Kills bad guys knocking on my ssh daemon { cp -u /usr/local/sbin/killit $DIR cp -u /usr/local/sbin/killit_plugin $DIR cp -u /usr/local/sbin/dropbad $DIR cp -u /usr/local/sbin/seen_it $DIR cp -u /usr/local/sbin/seenit_plugin $DIR cp -u /usr/local/sbin/stopscan_plugin $DIR } DIR=$BASE_DIR/NFS # Linux file sharing cp -u /etc/exports $DIR DIR=$BASE_DIR/Samba # M$ file sharing { rsync -a --exclude drivers/ /etc/samba/* $DIR/ echo `date` >$DIR/smb.conf.brief /usr/bin/testparm -s >> $DIR/smb.conf.brief 2>&1 } DIR=$BASE_DIR/Sendmail # Mail transport and delivery { cp -uR /etc/mail/* $DIR/ cp -u /home/$CONFIG_USER/.procmailrc $DIR/procmailrc.$CONFIG_USER echo "$LOCAL_CONFIG_NOTES" >$DIR/README echo " Local spamassassin configs have our spamd talking on ::1 (see system configs) so one needs to have any procmailrc recipes call spamc with -d localhost6 ie: | /usr/bin/spamc -d localhost6 ## can use IPv6 now -- DRF 7/10/13 " > $DIR/README-procmailConfig } DIR=$BASE_DIR/sshd # System secure shell { cp -uR /etc/ssh/* $DIR # # Selected users in WORD lists only their existing .ssh/config. # Default -- lists all users existing ~/.ssh/config. # WORD="" [ -z "$WORD" ] && WORD="`awk -F\":\" '{ printf \"%s \",$1 }' /etc/passwd`" for LISTED in $WORD; do if [ -f /home/$LISTED/.ssh/config ]; then cp /home/$LISTED/.ssh/config $DIR/ssh_config.$LISTED 2>&1 fi done } DIR=$BASE_DIR/httpd # Apache web server [ -d /var/www/html/ ] && \ { cp -uR /var/www/html/* $DIR cp -u /etc/httpd/conf/httpd.conf $DIR cp -uR /var/www/cgi-bin $DIR cp -u /home/anon/passwd $DIR /usr/sbin/httpd -S &> $DIR/VirtualHosts.txt echo "Our AuthUserFile is /home/anon/passwd because the /home directory is possibly mounted from a separate partition and independent of system upgrades. As almost all our pages are served from the home directories of users, this insures that our .htaccess files are always referring to an existing password file. Of course any user can set up their own .htpasswd files in some other location (outside of web access, I hope). DRF 2/14/09 (Happy Valentines day!)" > $DIR/htpasswd-README } DIR=$BASE_DIR/yum # Yellow-dog update manager { cp -u /etc/yum.conf $DIR cp -uR /etc/yum.repos.d/ $DIR/ } DIR=$BASE_DIR/usr-local-bin # Locally installed general executables cp -u /usr/local/bin/* $DIR/ # usr-local-sbin DIR=$BASE_DIR/usr-local-sbin # Locally installed system executables cp -u /usr/local/sbin/* $DIR/ DIR=$BASE_DIR/FormsAndScripts # Miscellaneous scripts { test -d /home/drf/FormsAndScripts && cp -u /home/drf/FormsAndScripts/* $DIR/ echo "$LOCAL_CONFIG_NOTES" >$DIR/README } DIR=$BASE_DIR/SysConfigs # Fedora system configs http://fedoraproject.org/ { rsync -a --delete --copy-links /etc/sysconfig $DIR/ rsync -a --delete --copy-links /etc/modprobe.d $DIR/ echo "$LOCAL_CONFIG_NOTES" >$DIR/README rsync -a /etc/sysctl.conf $DIR/etc.sysctl.conf /sbin/ip addr ls > $DIR/ConfiguredInterfaces echo -e "/usr/bin/inxi -Foc0 on $(date) \n" >$DIR/inxiBoxInfo /usr/bin/inxi -Foc0 >> $DIR/inxiBoxInfo # -FGrc0 or } DIR=$BASE_DIR/ApplicationConfigs # Application configs { #cp -u /etc/xtide.conf $DIR #cp -uR /etc/mplayer $DIR rsync -a /home/drf/.pinerc $DIR/drf.pinerc test -f /root/.pinerc && rsync -a /root/.pinerc $DIR/root.pinerc } DIR=$BASE_DIR/DisksIfacesRoutes # Disk, interface, and routing information { cp -u /usr/local/sbin/renew-default-route $DIR # Create a disktable file date > $DIR/disktable echo -e "\n\nfdisk -l ---->" >> $DIR/disktable /sbin/fdisk -l >>$DIR/disktable 2>/dev/null echo -e "\n\nfstab ---->">>$DIR/disktable cat /etc/fstab >> $DIR/disktable echo -e "\n\ndf -P ---->" >> $DIR/disktable /bin/df -P >> $DIR/disktable echo -e "\n\nudev ------>" >>$DIR/disktable ls -lR /dev/disk/ >>$DIR/disktable echo -e "\n\nblkid ------>" >>$DIR/disktable /sbin/blkid >>$DIR/disktable echo -en "\n\n End report " >> $DIR/disktable date >> $DIR/disktable } { # Network configuration date > $DIR/Network echo >> $DIR/Network /sbin/ifconfig >> $DIR/Network echo >> $DIR/Network /usr/sbin/brctl show >>$DIR/Network rsync -a /etc/aiccu.conf $DIR/ipV6Tunnel_aiccu.conf [ -f /usr/local/etc/aiccu-subnets.sh ] && rsync -a /usr/local/etc/aiccu-subnets.sh $DIR/ipV6Tunnel_aiccu-subnets.sh date > $DIR/Route echo >> $DIR/Route /sbin/route -n >> $DIR/Route echo >> $DIR/Route /sbin/route -A inet6 -n >> $DIR/Route } { # Update lvm info to /boot and to our archive rsync -a /etc/lvm/* $DIR/lvm/ rsync -a /etc/lvm/* /boot/lvm/ } # Entries below this line are in $BASE_DIR - not in subdirectories # _____________________________________________________________________________________ # # Warning README echo "$LOCAL_CONFIG_NOTES" >$BASE_DIR/README # Copy the passwd file cp -u /etc/passwd $BASE_DIR/passwd # Box details are kept in parent directory for now cp -u $BASE_DIR/../BoxDetails $BASE_DIR/ # Box data here # Preserve last dmesg { DMESG=$BASE_DIR/dmesg [ -f $DMESG ] && mv $DMESG $DMESG.bak date > $DMESG echo >>$DMESG dmesg >>$DMESG } # Scan hardware { date > $BASE_DIR/HardwareList echo >> $BASE_DIR/HardwareList /usr/bin/inxi -FGc0 -r >> $BASE_DIR/HardwareList 2>&1 } # Copy this script as executed to base directory { rsync $0 $BASE_DIR/ScriptAsRun rsync $0 $BASE_DIR/ } # Wait for all subshells to complete wait # Make sure all directories are browsable and readable find $BASE_DIR/ -type d |while read dirfound; do chmod 777 $dirfound; done # Create a file manifest of $BASE_DIR files & set modes to -rw-rw-r-- { find $BASE_DIR/ -type f | tee $BASE_DIR/FileManifest |\ while read filefound; do chmod 664 $filefound; done } # Change owership of all files to the config user chown -R $CONFIG_USER.$CONFIG_USER $BASE_DIR # End of script