disable revision 238438
1238438Sdteske#!/bin/sh 2238438Sdteske#- 3238438Sdteske# Copyright (c) 2012 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 238438 2012-07-14 03:16:57Z dteske $ 28238438Sdteske# 29238438Sdteske############################################################ INCLUDES 30238438Sdteske 31238438SdteskeBSDCFG_LIBE="/usr/libexec/bsdconfig" 32238438Sdteske. $BSDCFG_LIBE/include/common.subr || exit 1 33238438Sdteskef_include $BSDCFG_LIBE/include/dialog.subr 34238438Sdteskef_include $BSDCFG_LIBE/include/mustberoot.subr 35238438Sdteskef_include $BSDCFG_LIBE/include/sysrc.subr 36238438Sdteske 37238438SdteskeAPP_DIR="110.mouse" 38238438Sdteskef_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr 39238438Sdteske 40238438Sdteskeipgm=$( f_index_menu_selection $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" ) 41238438Sdteske[ $? -eq $SUCCESS -a "$ipgm" ] && pgm="$ipgm" 42238438Sdteske 43238438Sdteske############################################################ CONFIGURATION 44238438Sdteske 45238438Sdteske# 46238438Sdteske# Location of moused(8) pidfile 47238438Sdteske# 48238438SdteskeMOUSED_PIDFILE=/var/run/moused.pid 49238438Sdteske 50238438Sdteske############################################################ MAIN 51238438Sdteske 52238438Sdteske# Incorporate rc-file if it exists 53238438Sdteske[ -f "$HOME/.bsdconfigrc" ] && f_include "$HOME/.bsdconfigrc" 54238438Sdteske 55238438Sdteske# 56238438Sdteske# Process command-line arguments 57238438Sdteske# 58238438Sdteskewhile getopts hSX flag; do 59238438Sdteske case "$flag" in 60238438Sdteske h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm";; 61238438Sdteske esac 62238438Sdteskedone 63238438Sdteskeshift $(( $OPTIND - 1 )) 64238438Sdteske 65238438Sdteske# 66238438Sdteske# Initialize 67238438Sdteske# 68238438Sdteskef_dialog_init 69238438Sdteskef_dialog_title "$msg_mouse_disable" 70238438Sdteskef_dialog_backtitle "${ipgm:+bsdconfig }$pgm" 71238438Sdteskef_mustberoot_init 72238438Sdteske 73238438Sdteske# 74238438Sdteske# Stop the mouse daemon 75238438Sdteske# 76238438Sdteske[ -r "$MOUSED_PIDFILE" ] && 77238438Sdteske f_quietly kill "$( cat "$MOUSED_PIDFILE" )" 78238438Sdteskef_sysrc_set moused_enable "NO" || f_die 79238438Sdteskef_sysrc_set moused_type "NO" || f_die 80238438Sdteskef_sysrc_delete moused_port || f_die 81238438Sdteskef_sysrc_delete moused_flags || f_die 82238438Sdteske 83238438Sdteske# 84238438Sdteske# Message box 85238438Sdteske# 86238438Sdteskef_dialog_title "$msg_message" 87238438Sdteskehline="$hline_press_enter_or_space" 88238438Sdteskeprompt="$msg_mouse_daemon_is_disabled" 89238438Sdteskesize=$( f_dialog_buttonbox_size \ 90238438Sdteske "$DIALOG_TITLE" \ 91238438Sdteske "$DIALOG_BACKTITLE" \ 92238438Sdteske "$prompt" ) 93238438Sdteskeeval $DIALOG \ 94238438Sdteske --title \"\$DIALOG_TITLE\" \ 95238438Sdteske --backtitle \"\$DIALOG_BACKTITLE\" \ 96238438Sdteske --hline \"\$hline\" \ 97238438Sdteske --ok-label \"\$msg_ok\" \ 98238438Sdteske --msgbox \"\$prompt\" $size 99238438Sdteske 100238438Sdteskeexit $SUCCESS 101238438Sdteske 102238438Sdteske################################################################################ 103238438Sdteske# END 104238438Sdteske################################################################################ 105