disable revision 252178
1238438Sdteske#!/bin/sh
2247280Sdteske#-
3238438Sdteske# Copyright (c) 2012-2013 Devin Teske
4238438Sdteske# All Rights Reserved.
5238438Sdteske#
6238438Sdteske# Redistribution and use in source and binary forms, with or without
7238438Sdteske# modification, are permitted provided that the following conditions
8238438Sdteske# are met:
9238438Sdteske# 1. Redistributions of source code must retain the above copyright
10238438Sdteske#    notice, this list of conditions and the following disclaimer.
11238438Sdteske# 2. Redistributions in binary form must reproduce the above copyright
12238438Sdteske#    notice, this list of conditions and the following disclaimer in the
13238438Sdteske#    documentation and/or other materials provided with the distribution.
14238438Sdteske#
15238438Sdteske# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16238438Sdteske# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, THE
17238438Sdteske# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18238438Sdteske# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19238438Sdteske# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20238438Sdteske# DAMAGES (INLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21238438Sdteske# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22238438Sdteske# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23238438Sdteske# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24238438Sdteske# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25238438Sdteske# SUCH DAMAGE.
26238438Sdteske#
27238438Sdteske# $FreeBSD: head/usr.sbin/bsdconfig/mouse/disable 252178 2013-06-24 20:58:54Z dteske $
28250319Sdteske#
29238438Sdteske############################################################ INCLUDES
30247280Sdteske
31238438SdteskeBSDCFG_SHARE="/usr/share/bsdconfig"
32238438Sdteske. $BSDCFG_SHARE/common.subr || exit 1
33250323Sdteskef_dprintf "%s: loading includes..." "$0"
34247280Sdteskef_include $BSDCFG_SHARE/dialog.subr
35247280Sdteskef_include $BSDCFG_SHARE/mustberoot.subr
36250323Sdteskef_include $BSDCFG_SHARE/sysrc.subr
37250323Sdteske
38250323SdteskeBSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="110.mouse"
39250323Sdteskef_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr
40241653Sdteske
41250323Sdteskeipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
42250323Sdteske[ $? -eq $SUCCESS -a "$ipgm" ] && pgm="$ipgm"
43247280Sdteske
44247280Sdteske############################################################ CONFIGURATION
45250323Sdteske
46250323Sdteske#
47247280Sdteske# Location of moused(8) pidfile
48247280Sdteske#
49250323SdteskeMOUSED_PIDFILE=/var/run/moused.pid
50250323Sdteske
51247280Sdteske############################################################ MAIN
52247280Sdteske
53250323Sdteske# Incorporate rc-file if it exists
54241653Sdteske[ -f "$HOME/.bsdconfigrc" ] && f_include "$HOME/.bsdconfigrc"
55250323Sdteske
56250323Sdteske#
57247280Sdteske# Process command-line arguments
58250323Sdteske#
59250323Sdteskewhile getopts h$GETOPTS_STDARGS flag; do
60247280Sdteske	case "$flag" in
61238438Sdteske	h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm" ;;
62241653Sdteske	esac
63238438Sdteskedone
64247280Sdteskeshift $(( $OPTIND - 1 ))
65247280Sdteske
66247280Sdteske#
67247280Sdteske# Initialize
68247280Sdteske#
69247280Sdteskef_dialog_title "$msg_mouse_disable"
70247280Sdteskef_dialog_backtitle "${ipgm:+bsdconfig }$pgm"
71250323Sdteskef_mustberoot_init
72247280Sdteske
73247280Sdteske#
74247280Sdteske# Stop the mouse daemon
75247280Sdteske#
76249827Sdteske[ -r "$MOUSED_PIDFILE" ] &&
77247280Sdteske	f_quietly kill "$( cat "$MOUSED_PIDFILE" )"
78247280Sdteskef_sysrc_set moused_enable "NO" || f_die
79247280Sdteskef_sysrc_set moused_type "NO" || f_die
80245052Sdteskef_sysrc_delete moused_port || f_die
81250323Sdteskef_sysrc_delete moused_flags || f_die
82247280Sdteske
83250323Sdteske#
84247280Sdteske# Message box
85247280Sdteske#
86247280Sdteskef_dialog_title "$msg_message"
87247280Sdteskef_dialog_msgbox "$msg_mouse_daemon_is_disabled" "$hline_press_enter_or_space"
88250319Sdteske
89247280Sdteskeexit $SUCCESS
90252112Sdteske
91247280Sdteske################################################################################
92241653Sdteske# END
93247280Sdteske################################################################################
94247280Sdteske