summaryrefstree
path: root/kernel/scripts/replace_dir.sh
blob: f5fedc5cfd388548a69fc81a08e779748a1d37c9 (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
#!/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} ] || [ -d ${DST} ]
    then
      rm -rf ${DST}
    fi
    ln -s $(basename ${SRC}) ${DST}
  else
    echo "${SRC} does not exit"
    exit -1
  fi
fi