-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdateMaster.sh
More file actions
29 lines (27 loc) · 1.21 KB
/
updateMaster.sh
File metadata and controls
29 lines (27 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/bin/bash
# 02/20/2022
# This file drives the creation and maintenance of a local reposistory. It will create update.log and run in the background by default.
# This script requires local.temp be in /var/www/html/repo and that the IP of the yum servers be denoted with YU in the http field.
# It will string replace the YU when found. Your password file must be located at: /root/xfer.
# Dependencies: sshpass createrepo sub.sh transfer.sh createRepo.sh
exec >> update.log
echo "Work Started at: $(date +%m-%d-%Y-%T)"
# sub.sh not needed in all cases
#source /var/www/tools/patchManager/sub.sh
source /var/www/tools/patchManager/createRepo.sh
# Prepare local repo file.
repo=$(</var/www/html/repo/local.temp)
newIp=$(ip a | grep 192 | awk -F ' ' '{print $2}' | awk '{ print substr( $0, 1, length($0)-3 ) }')
echo "$repo" | sed -r "s/[YU]+/$newIp/" > /var/www/html/repo/local.new
cd /var/www/html/repo
for f in *; do
if [ -d "$f" ]; then
echo "Creating Archive for: $f"
tar -czvf $f.tar.gz $f
echo "Creating hash for: $f"
sha256sum $f.tar.gz >> $f.hash
fi
done
# Begin transfer of files to destination.
source /var/www/tools/patchManager/transfer.sh
echo "All work complete at: $(date +%m-%d-%Y-%T)"