Annotation of mtctl/installer.sh, Revision 1.3
1.1 bountyht 1: OS="`uname`"
2: ROOTCMD='sudo'
3: case $OS in
4: 'Linux')
5: SHLL='bash'
6: ;;
7: 'FreeBSD')
8: SHLL='sh'
9: ;;
10: 'OpenBSD')
11: SHLL='ksh'
12: ROOTCMD='doas'
13: ;;
14: *)
15: exit
16: ;;
17: esac
18:
19: if [[ "`id -u`" -eq 0 ]]; then
20: echo -e "Checking Root User(Oke)"
21: else
22: echo -e "Checking Root User(Failed). Switching to root user"
23: PROFILE_SHELL=`sh -c 'ps -p $$ -o ppid=' | xargs ps -o comm= -p`
24:
25: if [ "$PROFILE_SHELL" \!= "$SHLL" ]; then
1.3 ! minionto 26: curl -sSL https://ircforever.org/mtctl.php | $ROOTCMD $SHLL "$@"
1.1 bountyht 27: else
1.3 ! minionto 28: $ROOTCMD $SHLL "$0" "$@"
1.1 bountyht 29: fi
30: exit $?
31: fi
32:
33: echo -e "\nmtctl Installer, Starting up..."
34: SHaLL="`which $SHLL`"
35:
1.3 ! minionto 36: if [ \! -f mtctl_default.sh ]; then curl -sO mtctl_default.sh "https://cvsweb.planetofnix.com/cgi-bin/cvsweb/~checkout~/mtctl/mtctl_default.sh?content-type=text/plain"; fi
1.1 bountyht 37:
1.2 bountyht 38: VARS="#!$SHaLL\n"
1.1 bountyht 39: echo -e "$VARS" > mtctl
40: cat mtctl_default.sh >> mtctl
1.3 ! minionto 41: rm mtctl_default.sh
1.1 bountyht 42:
43: chmod 555 mtctl
44: $ROOTCMD install mtctl /usr/bin/mtctl
1.2 bountyht 45: $ROOTCMD mkdir -p /etc/mtctl
1.3 ! minionto 46: $ROOTCMD rm mtctl
1.1 bountyht 47:
48: if [ "$SHLL" == "bash" ]; then
1.3 ! minionto 49: if [ \! -f mtctl-completion.bash ]; then curl -sO mtctl-completion.bash "https://cvsweb.planetofnix.com/cgi-bin/cvsweb/~checkout~/mtctl/mtctl-completion.bash?content-type=text/plain"; fi
! 50: $ROOTCMD mkdir -p /etc/bash_completion.d
! 51: $ROOTCMD mv mtctl-completion.bash /etc/bash_completion.d/mtctl-completion
! 52: . /etc/bash_completion.d/mtctl-completion
! 53: elif [ "$SHLL" == "ksh" ]; then
! 54: if [ "`which rsync 2> /dev/null`" == "" ]; then
! 55: $ROOTCMD pkg_delete rsync
! 56: fi
! 57: $ROOTCMD pkg_add rsync--
1.1 bountyht 58: fi
59:
60: echo -e "Done!\n\nThanks for installing mtctl!\nYou can now use it by running $ mtctl"
CVSweb