disable revision 252987
1218893Sdim#!/bin/sh
2193326Sed#-
3193326Sed# Copyright (c) 2012-2013 Devin Teske
4193326Sed# All rights reserved.
5193326Sed#
6193326Sed# Redistribution and use in source and binary forms, with or without
7193326Sed# modification, are permitted provided that the following conditions
8193326Sed# are met:
9193326Sed# 1. Redistributions of source code must retain the above copyright
10193326Sed#    notice, this list of conditions and the following disclaimer.
11226633Sdim# 2. Redistributions in binary form must reproduce the above copyright
12263508Sdim#    notice, this list of conditions and the following disclaimer in the
13263508Sdim#    documentation and/or other materials provided with the distribution.
14263508Sdim#
15263508Sdim# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16193326Sed# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17193326Sed# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18263508Sdim# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19263508Sdim# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20193326Sed# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21193326Sed# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22193326Sed# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23263508Sdim# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24263508Sdim# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25263508Sdim# SUCH DAMAGE.
26263508Sdim#
27263508Sdim# $FreeBSD: head/usr.sbin/bsdconfig/mouse/disable 252987 2013-07-07 18:51:44Z dteske $
28234353Sdim#
29263508Sdim############################################################ INCLUDES
30263508Sdim
31263508SdimBSDCFG_SHARE="/usr/share/bsdconfig"
32263508Sdim. $BSDCFG_SHARE/common.subr || exit 1
33263508Sdimf_dprintf "%s: loading includes..." "$0"
34263508Sdimf_include $BSDCFG_SHARE/dialog.subr
35263508Sdimf_include $BSDCFG_SHARE/mustberoot.subr
36263508Sdimf_include $BSDCFG_SHARE/sysrc.subr
37263508Sdim
38263508SdimBSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="110.mouse"
39263508Sdimf_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr
40263508Sdim
41263508Sdimipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
42263508Sdim[ $? -eq $SUCCESS -a "$ipgm" ] && pgm="$ipgm"
43263508Sdim
44263508Sdim############################################################ CONFIGURATION
45263508Sdim
46263508Sdim#
47263508Sdim# Location of moused(8) pidfile
48263508Sdim#
49263508SdimMOUSED_PIDFILE=/var/run/moused.pid
50263508Sdim
51263508Sdim############################################################ MAIN
52263508Sdim
53263508Sdim# Incorporate rc-file if it exists
54263508Sdim[ -f "$HOME/.bsdconfigrc" ] && f_include "$HOME/.bsdconfigrc"
55263508Sdim
56263508Sdim#
57263508Sdim# Process command-line arguments
58263508Sdim#
59263508Sdimwhile getopts h$GETOPTS_STDARGS flag; do
60263508Sdim	case "$flag" in
61263508Sdim	h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm" ;;
62263508Sdim	esac
63263508Sdimdone
64263508Sdimshift $(( $OPTIND - 1 ))
65193326Sed
66193326Sed#
67263508Sdim# Initialize
68263508Sdim#
69263508Sdimf_dialog_title "$msg_mouse_disable"
70263508Sdimf_dialog_backtitle "${ipgm:+bsdconfig }$pgm"
71263508Sdimf_mustberoot_init
72263508Sdim
73263508Sdim#
74263508Sdim# Stop the mouse daemon
75263508Sdim#
76263508Sdim[ -r "$MOUSED_PIDFILE" ] &&
77263508Sdim	f_quietly kill "$( cat "$MOUSED_PIDFILE" )"
78263508Sdimf_sysrc_set moused_enable "NO" || f_die
79263508Sdimf_sysrc_set moused_type "NO" || f_die
80263508Sdimf_sysrc_delete moused_port || f_die
81263508Sdimf_sysrc_delete moused_flags || f_die
82263508Sdim
83263508Sdim#
84263508Sdim# Message box
85263508Sdim#
86263508Sdimf_dialog_title "$msg_message"
87263508Sdimf_dialog_msgbox "$msg_mouse_daemon_is_disabled" "$hline_press_enter_or_space"
88263508Sdim
89263508Sdimexit $SUCCESS
90263508Sdim
91263508Sdim################################################################################
92263508Sdim# END
93263508Sdim################################################################################
94263508Sdim