File: mcfn_install.in

package info (click to toggle)
mc 4.1.35-1
  • links: PTS
  • area: main
  • in suites: hamm
  • size: 6,924 kB
  • ctags: 9,665
  • sloc: ansic: 84,273; tcl: 1,779; makefile: 1,266; sh: 864; perl: 262; awk: 148; sed: 93; csh: 1
file content (67 lines) | stat: -rw-r--r-- 1,875 bytes parent folder | download
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
#/bin/sh
#
prefix=@prefix@
if test -n `echo $prefix | grep prefix`; then
    prefix=/usr/local
fi
if test x$BASH = x; then
    BASHRC=
else
    BASHRC=~/.bashrc
fi
if test "x$EUID" = x0; then
    PROFILE=/etc/profile
else
    PROFILE=~/.profile
fi
if test -f $PROFILE; then
    A=`grep "mc ()" $PROFILE`
    B=
    if test -n "$BASHRC"; then
	if test -f $BASHRC; then
	    B=`grep "mc ()" $BASHRC`
	fi
    fi
    if test -n "$A"; then
	:
    else 
        if test -n "$B"; then
	    :
	else
            A=`typeset -f | grep "mc ()" 2>/dev/null`
	    if test ! -n "$A"; then
	        echo "mc () installation."
		if test -n "$BASHRC"; then
		    echo "While examining your $PROFILE and $BASHRC,"
		else
	            echo "While examining your $PROFILE,"
		fi
		echo "I've found that you have no mc () function defined there."
		echo "This function enables a feature of mc(1) that when you leave mc(1),"
		echo "you return to a directory where you were in mc just before exiting"
		echo "and not to the directory you've started mc from."
	        echo "Would you like to append"
	        echo 'mc () { MC=`'$prefix'/bin/mc -P "$@"`; [ -n "$MC" ] && cd "$MC"; unset MC };'
		if test -n "$BASHRC"; then
	            echo "function to your (p) $PROFILE (mc function will be active in your login shells)"
		    echo -n "or to your (b) $BASHRC (in every bash instance) or (n) no? [p|b|n] "
		else
	            echo -n "function to your $PROFILE? [y|n] "
		fi
	        read rep
		if test -n "$BASHRC"; then
		    INITFILE=$BASHRC
		else
		    INITFILE=$PROFILE
		fi
	        case $rep in
		    [Nn]*) exit ;;
		    [Pp]*) INITFILE=$PROFILE ;;
	        esac
                echo >>$INITFILE
	        echo 'mc () { MC=`'$prefix'/bin/mc -P "$@"`; [ -n "$MC" ] && cd "$MC"; unset MC };' >>$INITFILE
	        echo "mc () function appended to your $INITFILE"
	    fi
        fi 
    fi
fi