disable revision 243112
1181776Skmacy#!/bin/sh 2184573Sscottl#- 3181776Skmacy# Copyright (c) 2012 Devin Teske 4181776Skmacy# All Rights Reserved. 5181776Skmacy# 6181776Skmacy# Redistribution and use in source and binary forms, with or without 7184573Sscottl# modification, are permitted provided that the following conditions 8181776Skmacy# are met: 9181776Skmacy# 1. Redistributions of source code must retain the above copyright 10181776Skmacy# notice, this list of conditions and the following disclaimer. 11181776Skmacy# 2. Redistributions in binary form must reproduce the above copyright 12181781Skmacy# notice, this list of conditions and the following disclaimer in the 13181781Skmacy# documentation and/or other materials provided with the distribution. 14181781Skmacy# 15181781Skmacy# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 16181776Skmacy# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, THE 17181776Skmacy# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18181776Skmacy# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 19181776Skmacy# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20181776Skmacy# DAMAGES (INLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21181776Skmacy# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22181776Skmacy# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23181776Skmacy# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24181776Skmacy# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25181776Skmacy# SUCH DAMAGE. 26181776Skmacy# 27181776Skmacy# $FreeBSD: head/usr.sbin/bsdconfig/mouse/disable 243112 2012-11-16 00:59:11Z dteske $ 28181776Skmacy# 29181776Skmacy############################################################ INCLUDES 30181776Skmacy 31181776SkmacyBSDCFG_SHARE="/usr/share/bsdconfig" 32181776Skmacy. $BSDCFG_SHARE/common.subr || exit 1 33181776Skmacyf_include $BSDCFG_SHARE/dialog.subr 34185567Sedf_include $BSDCFG_SHARE/mustberoot.subr 35181776Skmacyf_include $BSDCFG_SHARE/sysrc.subr 36181776Skmacy 37181776SkmacyBSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="110.mouse" 38181776Skmacyf_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr 39181776Skmacy 40181776Skmacyipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" ) 41181776Skmacy[ $? -eq $SUCCESS -a "$ipgm" ] && pgm="$ipgm" 42181776Skmacy 43181776Skmacy############################################################ CONFIGURATION 44181776Skmacy 45181776Skmacy# 46181776Skmacy# Location of moused(8) pidfile 47181776Skmacy# 48181776SkmacyMOUSED_PIDFILE=/var/run/moused.pid 49181776Skmacy 50181776Skmacy############################################################ MAIN 51181776Skmacy 52181776Skmacy# Incorporate rc-file if it exists 53181776Skmacy[ -f "$HOME/.bsdconfigrc" ] && f_include "$HOME/.bsdconfigrc" 54181776Skmacy 55181776Skmacy# 56181776Skmacy# Process command-line arguments 57181776Skmacy# 58181776Skmacywhile getopts hSX flag; do 59181776Skmacy case "$flag" in 60181776Skmacy h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm";; 61181776Skmacy esac 62181917Skmacydone 63181776Skmacyshift $(( $OPTIND - 1 )) 64181776Skmacy 65181776Skmacy# 66181776Skmacy# Initialize 67181776Skmacy# 68184957Skmacyf_dialog_init 69184957Skmacyf_dialog_title "$msg_mouse_disable" 70184957Skmacyf_dialog_backtitle "${ipgm:+bsdconfig }$pgm" 71184957Skmacyf_mustberoot_init 72184957Skmacy 73184957Skmacy# 74181776Skmacy# Stop the mouse daemon 75181776Skmacy# 76181776Skmacy[ -r "$MOUSED_PIDFILE" ] && 77181776Skmacy f_quietly kill "$( cat "$MOUSED_PIDFILE" )" 78181776Skmacyf_sysrc_set moused_enable "NO" || f_die 79181776Skmacyf_sysrc_set moused_type "NO" || f_die 80181776Skmacyf_sysrc_delete moused_port || f_die 81181776Skmacyf_sysrc_delete moused_flags || f_die 82181776Skmacy 83181776Skmacy# 84181776Skmacy# Message box 85181776Skmacy# 86181776Skmacyf_dialog_title "$msg_message" 87181776Skmacyhline="$hline_press_enter_or_space" 88181776Skmacyprompt="$msg_mouse_daemon_is_disabled" 89181776Skmacysize=$( f_dialog_buttonbox_size \ 90181776Skmacy "$DIALOG_TITLE" \ 91 "$DIALOG_BACKTITLE" \ 92 "$prompt" ) 93eval $DIALOG \ 94 --title \"\$DIALOG_TITLE\" \ 95 --backtitle \"\$DIALOG_BACKTITLE\" \ 96 --hline \"\$hline\" \ 97 --ok-label \"\$msg_ok\" \ 98 --msgbox \"\$prompt\" $size 99 100exit $SUCCESS 101 102################################################################################ 103# END 104################################################################################ 105