#!/bin/bash # This script downloads the current version of Samba available on the www.samba.org website and compiles/installs it. # It is only intended to be used as an update script, not as an installation script for a new isntall. Run this # script and your system will email you when the install is complete. If you originally compiled Sambe with any # special options, be sure to edit the "./configure" command below to add the necessary options. # Instructions: # Replace and with sender and recipient emails below (without the brackets). # Prerequisites: # This script requires the mailx package in order to send notification emails. # NOTE: This script is only for Samba installations compiled from source. If you installed Samba via your package # manager, DO NOT use this script. This script was developed on a CentOS 7 64-bit system. It may require # modification to work on other Linux distributions or architectures. # If you are using Samba as an Active Directory Domain Controller, ONLY USE THIS SCRIPT ON THE DOMAIN CONTROLLER # THAT DOES NOT HOLD ANY FSMO ROLES. Future enhancements to this script will include FSMO role checking and # automated role transfer. cd /tmp wget https://www.samba.org sambadlpath=`grep gzipped "index.html" | awk -F\" '{print $(NF-1)}'` rm -f index.html wget https://www.samba.org$sambadlpath tar xzf samba* cd samba* ./configure make systemctl stop samba make install systemctl start samba sambastatus=`systemctl status samba | grep Active | awk '{print $3;}'` if [[ "$sambastatus" == *"running"* ]] then echo "Samba `/usr/local/samba/bin/smbclient -V` successfully installed. Current status: $sambastatus." | mail -r dc1@preissner.us -s "Samba update complete" mike@preissner.us fi