1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- if [ "$SRC" != "" ]
- then
- set -A tokens "$SRC"
- if [ "${tokens[3]}" = "file" ]
- then
- if [ -f "${tokens[0]}" ]
- then
- printf "exists "
- else
- printf "MISSING or REMOVED "
- echo "${tokens[0]}"
- continue
- fi
- elif [ "${tokens[3]}" = "sym_link" ]
- then
- if [ -L "${tokens[0]}" ]
- then
- printf "exists "
- else
- printf "MISSING or REMOVED "
- echo "${tokens[0]}"
- continue
- fi
- fi
- if [ "${tokens[3]}" = "file" ]
- then
- touch /tmp/config-test
- chmod "${tokens[1]}" /tmp/config-test
- tmpperms=$(ls -l /tmp/config-test | awk '{print $1}')
- realperms=$(ls -l "${tokens[0]}" | awk '{print $1}')
- if [ "$tmpperms" = "$realperms" ]
- then
- printf "correct "
- else
- printf " WRONG "
- fi
- owner=$(ls -l "${tokens[0]}" | awk '{print $3}')
- if [ "$owner" = "${tokens[4]}" ]
- then
- printf "correct "
- else
- printf " WRONG "
- fi
- group=$(ls -l "${tokens[0]}" | awk '{print $4}')
- if [ "$group" = "${tokens[5]}" ]
- then
- printf "correct "
- else
- printf " WRONG "
- fi
- elif [ "${tokens[3]}" = "sym_link" ]
- then
- linkto=$(ls -l "${tokens[0]}" | awk '{print $11}')
- if [ "${tokens[2]}" = "$linkto" ]
- then
- printf " the link is correct "
- else
- printf " the link is WRONG "
- fi
- fi
- echo "${tokens[0]}"
- fi
|