disable revision 256281
1139749Simp#!/bin/sh
2136467Ssimokawa#-
3136467Ssimokawa# Copyright (c) 2012-2013 Devin Teske
4181905Sed# All rights reserved.
5136467Ssimokawa#
6136467Ssimokawa# Redistribution and use in source and binary forms, with or without
7136467Ssimokawa# modification, are permitted provided that the following conditions
8136467Ssimokawa# are met:
9136467Ssimokawa# 1. Redistributions of source code must retain the above copyright
10136467Ssimokawa#    notice, this list of conditions and the following disclaimer.
11136467Ssimokawa# 2. Redistributions in binary form must reproduce the above copyright
12136467Ssimokawa#    notice, this list of conditions and the following disclaimer in the
13136467Ssimokawa#    documentation and/or other materials provided with the distribution.
14136467Ssimokawa#
15136467Ssimokawa# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16136467Ssimokawa# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17136467Ssimokawa# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18136467Ssimokawa# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19136467Ssimokawa# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20136467Ssimokawa# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21181905Sed# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22136467Ssimokawa# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23136467Ssimokawa# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24136467Ssimokawa# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25136467Ssimokawa# SUCH DAMAGE.
26136467Ssimokawa#
27136467Ssimokawa# $FreeBSD: stable/10/usr.sbin/bsdconfig/mouse/disable 252987 2013-07-07 18:51:44Z dteske $
28136467Ssimokawa#
29136467Ssimokawa############################################################ INCLUDES
30136467Ssimokawa
31136467SsimokawaBSDCFG_SHARE="/usr/share/bsdconfig"
32136467Ssimokawa. $BSDCFG_SHARE/common.subr || exit 1
33181905Sedf_dprintf "%s: loading includes..." "$0"
34136467Ssimokawaf_include $BSDCFG_SHARE/dialog.subr
35136467Ssimokawaf_include $BSDCFG_SHARE/mustberoot.subr
36136467Ssimokawaf_include $BSDCFG_SHARE/sysrc.subr
37136467Ssimokawa
38136467SsimokawaBSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="110.mouse"
39136467Ssimokawaf_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr
40136467Ssimokawa
41136467Ssimokawaipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
42136467Ssimokawa[ $? -eq $SUCCESS -a "$ipgm" ] && pgm="$ipgm"
43136467Ssimokawa
44136467Ssimokawa############################################################ CONFIGURATION
45136467Ssimokawa
46136467Ssimokawa#
47136467Ssimokawa# Location of moused(8) pidfile
48136467Ssimokawa#
49164033SrwatsonMOUSED_PIDFILE=/var/run/moused.pid
50136467Ssimokawa
51136467Ssimokawa############################################################ MAIN
52136467Ssimokawa
53136467Ssimokawa# Incorporate rc-file if it exists
54136467Ssimokawa[ -f "$HOME/.bsdconfigrc" ] && f_include "$HOME/.bsdconfigrc"
55136467Ssimokawa
56136467Ssimokawa#
57136467Ssimokawa# Process command-line arguments
58136467Ssimokawa#
59136467Ssimokawawhile getopts h$GETOPTS_STDARGS flag; do
60136467Ssimokawa	case "$flag" in
61136467Ssimokawa	h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm" ;;
62136467Ssimokawa	esac
63136467Ssimokawadone
64136467Ssimokawashift $(( $OPTIND - 1 ))
65136467Ssimokawa
66136467Ssimokawa#
67136467Ssimokawa# Initialize
68170017Ssimokawa#
69170017Ssimokawaf_dialog_title "$msg_mouse_disable"
70170017Ssimokawaf_dialog_backtitle "${ipgm:+bsdconfig }$pgm"
71136467Ssimokawaf_mustberoot_init
72170017Ssimokawa
73136467Ssimokawa#
74190771Sed# Stop the mouse daemon
75136467Ssimokawa#
76136467Ssimokawa[ -r "$MOUSED_PIDFILE" ] &&
77136467Ssimokawa	f_quietly kill "$( cat "$MOUSED_PIDFILE" )"
78136467Ssimokawaf_sysrc_set moused_enable "NO" || f_die
79136467Ssimokawaf_sysrc_set moused_type "NO" || f_die
80136467Ssimokawaf_sysrc_delete moused_port || f_die
81136467Ssimokawaf_sysrc_delete moused_flags || f_die
82136467Ssimokawa
83136467Ssimokawa#
84136467Ssimokawa# Message box
85136467Ssimokawa#
86136467Ssimokawaf_dialog_title "$msg_message"
87136467Ssimokawaf_dialog_msgbox "$msg_mouse_daemon_is_disabled" "$hline_press_enter_or_space"
88136467Ssimokawa
89136467Ssimokawaexit $SUCCESS
90136467Ssimokawa
91136467Ssimokawa################################################################################
92136467Ssimokawa# END
93136467Ssimokawa################################################################################
94136467Ssimokawa