forked from grabadabar/old_project
-
Notifications
You must be signed in to change notification settings - Fork 0
/
SlES12_migration_new
95 lines (83 loc) · 2.7 KB
/
SlES12_migration_new
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#!/bin/bash
CONF=etc
OLDSLES=mnt
LOG=set_configuration.log
COMMAND=$(systemctl)
#mount suse11 disk in the /mnt
mount /dev/$1/root /$OLDSLES/
mount /dev/$1/opt /$OLDSLES/opt/
mount /dev/$1/tmp /$OLDSLES/tmp/
mount /dev/$1/home /$OLDSLES/usr2/local/
#transfer inportant files and configuration
rsync -avz /$OLDSLES/usr/local/bin/ /usr/local/bin/
rsync -avz /$OLDSLES/$CONF/ssh/ /$CONF/ssh/
rsync -avz /$OLDSLES/$CONF/BASFfirewall.d/ /$CONF/BASFfirewall.d/
rsync -avz /$OLDSLES/root/.ssh/ /root/.ssh/
cp -fr /$OLDSLES/$CONF/sysctl.conf /$CONF/sysctl.conf
cp -fr /$OLDSLES/$CONF/resolv.conf /$CONF/resolv.conf
cp -fr /$OLDSLES/$CONF/passwd /$CONF/passwd
cp -fr /$OLDSLES/$CONF/shadow /$CONF/shadow
cp -fr /$OLDSLES/$CONF/auto.master /$CONF/auto.master
cp -fr /$OLDSLES/$CONF/auto.apps /$CONF/auto.apps
cp -fr /$OLDSLES/$CONF/nscd.conf /$CONF/nscd.conf
#set rpcbind user
echo "rpc:x:495:65534:user for rpcbind:/var/lib/empty:/sbin/nologin" >> /$CONF/passwd
echo "root:sles11to12" |chpasswd
cp -fr /$OLDSLES/$CONF/services /$CONF/services
cp -fr /$OLDSLES/$CONF/auto.master /$CONF/auto.master
rsync -avz /$OLDSLES/root/scripts/ /root/scripts/
rsync -avz /$OLDSLES/opt/special/ /opt/special/ && ln -s /opt/special/ /special/
#check if oracles DB is installed and running
if [ -f /$OLDSLES/etc/oratab ]
then
cp -fr /$OLDSLES/etc/oratab /etc/oratab
if [ -f /$OLDSLES/etc/orainst.loc ]
then
cp -fr /$OLDSLES/etc/orainst.loc /etc/orainst.loc
else
echo "there is not orainst.loc"
fi
else
echo "There is not oracle DB installed"
fi
#setup network
for p in {0..1}
do
if [ -f /etc/sysconfig/network/ifcfg-eth$p ]
then
ls -la /$OLDSLES/etc/sysconfig/network/ifcfg-eth$p
rsync -avz /$OLDSLES/etc/sysconfig/network/ /etc/sysconfig/network/ &&
systemctl restart network
else
echo "names are difrent"
fi
done
#local host set
echo 'ypserver localhost' > /etc/yp.conf
echo 'basfad.basf.net' > /etc/defaultdomain
domainname $( cat /etc/defaultdomain )
#set hostname
hostnamectl set-hostname $2
#set corect services boot with OS
$COMMAND enable rpcbind
$COMMAND enable nscd
$COMMAND enable ypbind
$COMMAND enable vasd
$COMMAND enable vasypd
$COMMAND enable autofs
#check
diff /$CONF/sysctl.conf /$OLDSLES/$CONF/sysctl.conf >> $LOG
diff /$CONF/resolv.conf /$OLDSLES/$CONF/resolv.conf >> $LOG
diff /$CONF/passwd /$OLDSLES/$CONF/passwd >> $LOG
diff /$CONF/shadow /$OLDSLES/$CONF/shadow >> $LOG
diff /$CONF/services /$OLDSLES/$CONF/services >> $LOG
diff /$CONF/auto.master /$OLDSLES/$CONF/auto.master >> $LOG
#read
echo "Check diferrences betwen fstabs and cofigure corectly\n Check autofs configuration too\n"
read
if [ -s $LOG ]
then
cat $LOG
else
reboot
fi