Use deployserver's timezone in daisy VM 17/48917/1
authorAlex Yang <yangyang1@zte.com.cn>
Thu, 14 Dec 2017 07:39:25 +0000 (15:39 +0800)
committerAlex Yang <yangyang1@zte.com.cn>
Thu, 14 Dec 2017 07:39:25 +0000 (15:39 +0800)
Change-Id: Ie58af69f444924494d1a2949ba894ae55da7efc9
Signed-off-by: Alex Yang <yangyang1@zte.com.cn>
tools/centos-img-modify.sh
tools/daisy-img-modify.sh

index 31f122f..fe35126 100755 (executable)
@@ -63,3 +63,8 @@ cat << EOF > /etc/cloud/cloud.cfg.d/default.cfg
 disable_root: False
 ssh_pwauth: True
 EOF
+
+cd /etc
+if [ ! -z $localtime_file ] && [ -f $localtime_file ]; then
+    ln -s -f $localtime_file /etc/localtime
+fi
index aad2994..43fd186 100755 (executable)
@@ -186,6 +186,12 @@ setup() {
 
     chroot $mountdir df -h
     cp $cmd $mountdir/$(basename $cmd)
+
+    if [ -h /etc/localtime ]; then
+        export localtime_file=$(ls -l /etc/localtime | grep "^l" | awk '{print $11}')
+    elif [ -f /etc/localtime ]; then
+        cp /etc/loccaltime $mountdir/etc/
+    fi
 }
 
 # modify image running a script using in a chrooted environment