summaryrefstree
path: root/kernel/scripts/replace_dir.sh
blob: ddb8b7a918c1b618496930588dd4f8b06c36f9db (plain)
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
#!/bin/sh
# Support selinux version
# replace_directory dst src
DST="$1/$2"
SRC="$1/$3"

if [ "x${DST}" == "x${SRC}" ]
then
  #echo "${DST} and ${SRC} is same"
  exit 0
else
  if [ -d ${SRC} ]
  then
    if [ -L ${DST} ]
    then
      rm -f ${DST}
    elif [ -d ${DST} ]
    then
      rm -r ${DST}
    fi
    ln -s $(basename ${SRC}) ${DST}
  else
    echo "${SRC} does not exit"
    exit -1
  fi
fi