This file is indexed.

/usr/sbin/switchconf is in switchconf 0.0.9-2.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  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
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
#!/bin/sh

# switchconf -- Easy configuration switch
#
# (c) 2002 Sebastien J. Gross <sjg@debian.org>
# (c) 2005 Jose Calhariz <jose.calhariz@tagus.ist.utl.pt>
# Please see the COPYRIGHT file included in the package.
# $Id: switchconf,v 1.9 2002/04/22 19:04:45 jul Exp $
#

logfile="/var/log/switchconf"
memfile="/var/lib/misc/switchconf.lastcfg"
lockfile="/var/lock/switchconf"

if [ -f /etc/switchconf/conf ]; then
    .  /etc/switchconf/conf
elif [ -f ./conf ]; then
    .  ./conf
else
    echo "Configuration file not found"
    exit
fi


help() {
    echo "Syntax: switchconf [ configuration | -list | -help ]"
    exit 0
}

list() {
    cd ${conf_top_dirs}
    find -maxdepth 1 -type d | sed 's/^\.\/\?//' | grep -v "\(^\$\|${exec_dir_before}\|${exec_dir_after}\)" | sort
    exit 0
}

run_scripts(){
    local scriptsdir=$1
    shift
    if test -x "${run_parts}" ; then
	echo "Executing scripts: ";
	${run_parts} --arg "${conf}" -v "$scriptsdir" 2>&1 | tee -a ${logfile} 
	echo "Executing scripts done.";
    else
	echo "Executing scripts: ";
	for r in `find ${scriptsdir} -type f -perm +1 | sort`; do
	    echo "$r" | tee -a ${logfile}
	    ${r} "${conf}" 2>&1 | tee -a ${logfile}
	done
	echo "Executing scripts done.";
    fi
}

run_scripts_before(){
    run_scripts ${conf_top_dirs}/${exec_dir_before}
}

run_scripts_after(){
    run_scripts ${conf_top_dirs}/${exec_dir_after}
}

# validates configuration file
config_method=${config_method:=softlink}
case ${config_method} in
    softlink)
    ;;
    hardlink)
    ;;
    copy)
    ;;
    *)
	echo "Check you configuration"
	echo "config_method option have unsupported value'$config_method'"
	exit
esac

[ $# -eq 1 ] || help
conf=$1

case ${conf} in
    -list | -l )
	list
	;;
    -help | -h )
	help
	;;
esac

cd ${conf_top_dirs}
if [ ! -d ${conf} ]; then
    echo "Configuration ${conf} not found"
fi



# Check last run of switchconf have stoped
if ! dotlockfile -p -l -r 1 "${lockfile}" ; then
    echo "There is another switchconf still runing" | tee -a ${logfile} 
    echo "Aborting" | tee -a ${logfile} 
    exit 1;
fi

# executing each scripts before
run_scripts_before

for f in `find ${conf} ! -type d | sed "s/^${conf}\///"`; do
    dir=`dirname ${dest_dir}/${f}`
    [ -d ${dir} ] || mkdir -p ${dir}
    case ${config_method} in
	copy)
	    if test -e ${dest_dir}/${f} ; then
		mv -f ${dest_dir}/${f} ${dest_dir}/${f}.SWITCHCONF && \
		    cp -fa ${conf_top_dirs}/${conf}/${f} ${dest_dir}/${f} && \
		    rm -f ${dest_dir}/${f}.SWITCHCONF
	    else
		    cp -fa ${conf_top_dirs}/${conf}/${f} ${dest_dir}/${f}
	    fi		
	    ;;
	hardlink)
	    if test -e ${dest_dir}/${f} ; then
		mv -f ${dest_dir}/${f} ${dest_dir}/${f}.SWITCHCONF && \
		    cp -fal ${conf_top_dirs}/${conf}/${f} ${dest_dir}/${f} && \
		    rm -f ${dest_dir}/${f}.SWITCHCONF
	    else
		cp -fal ${conf_top_dirs}/${conf}/${f} ${dest_dir}/${f}
	    fi		
	    ;;
	softlink|*)
	    if test -e ${dest_dir}/${f} ; then
		mv -f ${dest_dir}/${f} ${dest_dir}/${f}.SWITCHCONF && \
		    ln -s ${conf_top_dirs}/${conf}/${f} ${dest_dir}/${f} && \
		    rm -f ${dest_dir}/${f}.SWITCHCONF
	    else
		ln -s ${conf_top_dirs}/${conf}/${f} ${dest_dir}/${f}
	    fi
    esac
done

# executing each scripts after
run_scripts_after

echo "${conf}" > ${memfile}

# remove lock
dotlockfile -u "${lockfile}"
exit 0