Accepting request 827372 from home:AngelaBriel:clone-master-clean-up
cleanup salt client ID and osad authentication configuration file and the system ID (bsc#1174147) change the path of the template file in the comments of custom_remove.template and clone-master-clean-up.sh (jsc#TEAM-490) OBS-URL: https://build.opensuse.org/request/show/827372 OBS-URL: https://build.opensuse.org/package/show/systemsmanagement/clone-master-clean-up?expand=0&rev=8
This commit is contained in:
parent
759fae8065
commit
75168fe5d5
@ -91,6 +91,12 @@ System random seeds.
|
||||
.IP \[bu]
|
||||
Systemd journal.
|
||||
.IP \[bu]
|
||||
machine ID.
|
||||
.IP \[bu]
|
||||
Salt client ID.
|
||||
.IP \[bu]
|
||||
osad authentication configuration file and the system ID.
|
||||
.IP \[bu]
|
||||
Domain and host names.
|
||||
.IP \[bu]
|
||||
/etc/hostname, /etc/hosts, /etc/resolv.conf are restored to original.
|
||||
|
@ -1,3 +1,14 @@
|
||||
-------------------------------------------------------------------
|
||||
Wed Aug 12 15:44:30 UTC 2020 - abriel@suse.com
|
||||
|
||||
- Bump version to 1.6
|
||||
- cleanup salt client ID and osad authentication configuration
|
||||
file and the system ID
|
||||
(bsc#1174147)
|
||||
- change the path of the template file in the comments of
|
||||
custom_remove.template and clone-master-clean-up.sh
|
||||
(jsc#TEAM-490)
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue Oct 8 13:24:41 UTC 2019 - abriel@suse.com
|
||||
|
||||
|
@ -17,7 +17,7 @@ trap 'err_exit $LINENO' ERR
|
||||
[ "$UID" != "0" ] && echo 'Please run this program as root user.' && exit 1
|
||||
|
||||
echo 'The script will delete all SSH keys, log data, and more. Type YES and enter to proceed.'
|
||||
read answer
|
||||
read -r answer
|
||||
[ "$answer" != "YES" ] && exit 1
|
||||
|
||||
# source config file
|
||||
@ -29,7 +29,7 @@ else
|
||||
fi
|
||||
|
||||
echo 'Wiping active swap devices/files (this may take a while)'
|
||||
while read swap_name discard; do
|
||||
while read -r swap_name discard; do
|
||||
uuid=$(env $(blkid -o export "$swap_name") printenv UUID)
|
||||
echo "Turning off swap device/file $swap_name (UUID $uuid)"
|
||||
swapoff "$swap_name"
|
||||
@ -78,8 +78,17 @@ systemctl restart systemd-journald
|
||||
mv journald.conf.bak journald.conf
|
||||
popd > /dev/null
|
||||
|
||||
echo 'Clearing systemd machine ID file'
|
||||
echo 'Clearing machine ID file'
|
||||
# on distributions that support systemd
|
||||
truncate -s 0 /etc/machine-id
|
||||
# on distributions that do not support systemd
|
||||
[ ! -f /etc/machine-id ] && truncate -s 0 /var/lib/dbus/machine-id
|
||||
|
||||
echo 'Removing Salt client ID'
|
||||
[ -f /etc/salt/minion_id ] && rm -f /etc/salt/minion_id
|
||||
|
||||
echo 'Removing osad authentication configuration file and the system ID'
|
||||
rm -f /etc/sysconfig/rhn/{osad-auth.conf,systemid}
|
||||
|
||||
echo 'Removing domain name and set host name from DHCP in network config'
|
||||
sed -i 's/^NETCONFIG_DNS_STATIC_SEARCHLIST=.*$/NETCONFIG_DNS_STATIC_SEARCHLIST=""/g' /etc/sysconfig/network/config
|
||||
@ -181,7 +190,7 @@ EOF
|
||||
fi
|
||||
|
||||
echo 'Would you like to give root user a new password? Type YES to set a new password, otherwise simply press Enter.'
|
||||
read answer
|
||||
read -r answer
|
||||
[ "$answer" == "YES" ] && passwd root
|
||||
|
||||
if [ "$CMCU_EC2" = "yes" ]; then
|
||||
@ -196,22 +205,22 @@ fi
|
||||
|
||||
if [ "$CMCU_USERIDS" = "yes" ]; then
|
||||
echo "clean up user ids >= 1000"
|
||||
for i in `awk -F ":" '$3 >= 1000 && $1 !~ /nobody/ {print $1}' /etc/passwd`; do
|
||||
userdel -r $i
|
||||
for i in $(awk -F ":" '$3 >= 1000 && $1 !~ /nobody/ {print $1}' /etc/passwd); do
|
||||
userdel -r "$i"
|
||||
done
|
||||
fi
|
||||
|
||||
echo "swap the uuid strings with dev strings in /etc/fstab"
|
||||
> /tmp/fstab.tmp
|
||||
while read disk remain; do
|
||||
while read -r disk remain; do
|
||||
case "$disk" in
|
||||
UUID=*)
|
||||
uuid=${disk#UUID=}
|
||||
new_disk=`/usr/sbin/blkid -U $uuid`
|
||||
new_disk=$(/usr/sbin/blkid -U "$uuid")
|
||||
;;
|
||||
LABEL=*)
|
||||
label=${disk#LABEL=}
|
||||
new_disk=`/usr/sbin/blkid -L $label`
|
||||
new_disk=$(/usr/sbin/blkid -L "$label")
|
||||
;;
|
||||
*)
|
||||
new_disk="$disk"
|
||||
@ -226,11 +235,11 @@ rm -rf /tmp/fstab.tmp
|
||||
|
||||
echo "Clean up network files (except interfaces using dhcp boot protocol)"
|
||||
# additional files like bondig interfaces or vlans can be found in
|
||||
# /var/adm/clone-master-clean-up/custom_remove.template
|
||||
for intf in `ls -1 /etc/sysconfig/network/ifcfg-eth*`; do
|
||||
bprot=`grep "^BOOTPROTO=" $intf | sed "s/^BOOTPROTO=//"`
|
||||
# /usr/share/clone-master-clean-up/custom_remove.template
|
||||
for intf in /etc/sysconfig/network/ifcfg-eth*; do
|
||||
bprot=$(grep "^BOOTPROTO=" "$intf" | sed "s/^BOOTPROTO=//")
|
||||
if ! [[ "$bprot" =~ dhcp ]]; then
|
||||
rm -rf $intf
|
||||
rm -rf "$intf"
|
||||
fi
|
||||
done
|
||||
if [ -d /var/lib/wicked ]; then
|
||||
|
@ -1,7 +1,7 @@
|
||||
#
|
||||
# spec file for package clone-master-clean-up
|
||||
#
|
||||
# Copyright (c) 2017-2019 SUSE LLC
|
||||
# Copyright (c) 2017-2020 SUSE LLC
|
||||
#
|
||||
# All modifications and additions to the file contributed by third parties
|
||||
# remain the property of their copyright owners, unless otherwise agreed
|
||||
@ -17,12 +17,12 @@
|
||||
|
||||
|
||||
Name: clone-master-clean-up
|
||||
Version: 1.5
|
||||
Version: 1.6
|
||||
Release: 0
|
||||
Summary: Tool to clean up a system for cloning preparation
|
||||
License: GPL-2.0-or-later
|
||||
Group: System/Management
|
||||
Url: https://www.suse.com
|
||||
URL: https://www.suse.com
|
||||
Source0: clone-master-clean-up.sh
|
||||
Source1: clone-master-clean-up.1
|
||||
Source2: sysconfig.clone-master-clean-up
|
||||
|
@ -5,8 +5,8 @@
|
||||
# use cases.
|
||||
# See some examples for additional needed clean ups below.
|
||||
#
|
||||
# Please copy the template file '/var/adm/clone-master-clean-up/custom_remove.template'
|
||||
# to '/var/adm/clone-master-clean-up/custom_remove' and un-comment the parts
|
||||
# Please copy the template file '/usr/share/clone-master-clean-up/custom_remove.template'
|
||||
# to '/etc/clone-master-clean-up/custom_remove' and un-comment the parts
|
||||
# you need or add additional parts, which will fit your needs.
|
||||
# Please be careful, the template file will be changed during future package
|
||||
# updates. So do NOT change the content. It will get lost. Always make changes
|
||||
|
Loading…
Reference in New Issue
Block a user