--- motif-config +++ motif-config @@ -59,6 +59,7 @@ _activate_profile() { _check_root + local retval=0 if [ -z "${1}" ]; then return 0 @@ -71,35 +72,47 @@ for file in `ls /usr/lib/${new}/ | grep lib`; do files="${files} /usr/lib/${file}" rm -f /usr/lib/${file} + retval=$((retval | $? )) ln -s /usr/lib/${new}/${file} /usr/lib/${file} + retval=$((retval | $? )) done # includes for file in `ls /usr/include/${new}/`; do files="${files} /usr/include/${file}" rm -f /usr/include/${file} + retval=$((retval | $? )) ln -s /usr/include/${new}/${file} /usr/include/${file} + retval=$((retval | $? )) done # binaries for file in `ls /usr/lib/${new} | grep -v lib`; do files="${files} /usr/bin/${file}" rm -f /usr/bin/${file} + retval=$((retval | $? )) ln -s /usr/lib/${new}/${file} /usr/bin/${file} + retval=$((retval | $? )) done # man pages for file in `find /usr/share/man -regex ".*-${new}\..x?.gz"`; do files="${files} ${file/-${new}/}" rm -f ${file/-${new}/} + retval=$((retval | $? )) ln -s ${file} ${file/-${new}/} + retval=$((retval | $? )) done cat ${PROFILE_PATH}/${new} > ${CONFIG_FILE} + retval=$((retval | $? )) echo "FILES='${files}'" >> ${CONFIG_FILE} + retval=$((retval | $? )) + test $retval -eq 0 return $? } _deactivate_profile() { _check_root + local retval=0 source ${CONFIG_FILE} 2>/dev/null current=${PROFILE} @@ -110,42 +123,54 @@ for file in ${FILES}; do rm -f ${file} + retval=$((retval | $? )) done rm -f ${CONFIG_FILE} + retval=$((retval | $? )) + test $retval -eq 0 return $? } switch_profile() { _check_root + local retval=0 if [ -n "$1" ]; then if [ ! -e ${PROFILE_PATH}/${1} ]; then eerror "$0: no such profile ${1}" + retval=1 else _deactivate_profile + retval=$((retval | $? )) _activate_profile $1 + retval=$((retval | $? )) fi else source ${CONFIG_FILE} 2> /dev/null _deactivate_profile + retval=$((retval | $? )) if [ -z "${PROFILE}" -o ! -f ${PROFILE_PATH}/${PROFILE} ]; then for y in `ls ${PROFILE_PATH} | grep -v removed | grep -v current | sort -r`; do _activate_profile ${y} + retval=$((retval | $? )) break done if [ -z "${y}" ]; then eerror "$0: no profile to activate" + retval=1 fi else _activate_profile ${PROFILE} + retval=$((retval | $? )) fi fi source ${CONFIG_FILE} 2>/dev/null einfo "$0: New default Profile is: ${PROFILE}" + test $retval -eq 0 return $? }