Some Simple Shell: Let's Find Some Short Shell Script To Analize
Some Simple Shell: Let's Find Some Short Shell Script To Analize
Some Simple Shell: Let's Find Some Short Shell Script To Analize
#!/bin/sh
. /usr/share/acpi-support/key-constants
acpi_fakekey $KEY_VOLUMEDOWN
PATH=/sbin:/bin
. /lib/lsb/init-functions
do_start () {
■log_action_msg "Will now switch to single-user mode"
■exec init -t1 S
}
case "$1" in
start)
■do_start
■;;
restart|reload|force-reload)
■echo "Error: argument '$1' not supported" >&2
■exit 3
■;;
stop)
■# No-op
■;;
*)
■echo "Usage: $0 start|stop" >&2
■exit 3
■;;
esac
#!/bin/sh
# So:
# IBM && !Series60 => nothing
# IBM && Series60 => Touchpad toggle
# LENOVO && ThinkPad => Touchpad toggle
toggle_touchpad=0
system_manufactuer=`dmidecode -s system-manufacturer`
case "$system_manufactuer" in
IBM*)
system_version=`dmidecode -s system-version`
case "$system_version" in
■ThinkPad\ [TXZ]60*)
■toggle_touchpad=1
■;;
esac
;;
LENOVO*)
toggle_touchpad=1
;;
esac
#!/bin/sh
# wrapper around db_get to ensure that the info we try to retrieve exists; it
# is (almost) always a fatal error for the values to be null
fetch () {
db_get "$1" || true
if [ -z "$RET" ]; then
ERRMSG="cannot generate configuration file; $1 not set. Aborting."
ERRMSG="$ERRMSG Reconfigure the X server with \"dpkg-reconfigure"
ERRMSG="$ERRMSG xserver-xorg\" to correct this problem."
bomb "$ERRMSG"
fi
}
SERVER="xorg"
XF86CONFIG=/etc/X11/xorg.conf.failsafe
PROGNAME=${0##*/}
SHOWHELP=
EARLYEXIT=
if [ $? -ne 0 ]; then
bomb "error while getting options; use \"$PROGNAME --help\" for help"
fi
eval set -- "$GETOPT_OUTPUT"
while :; do
case "$1" in
-f|--format)
bomb "This option, and XFree86 3.x output, are no longer supported."
;;
-h|--help) SHOWHELP=yes EARLYEXIT=yes ;;
-o|--output) XF86CONFIG="$2"; shift ;;
--) shift; break ;;
*)
bomb "unrecognized option \"$1\"; use \"$PROGNAME --help\" for help"
;;
esac
shift
done
if [ -n "$SHOWHELP" ]; then
usage
fi
if [ -n "$EARLYEXIT" ]; then
exit 0
fi
DEXCONFTMPDIR=
if [ ! -d "$TDIR_PARENT" ]; then
bomb "cannot create temporary work directory; \"$TDIR_PARENT\" does not" \
"exist or is not a directory"
fi
if [ ! -w "$TDIR_PARENT" ]; then
bomb "cannot create temporary work directory in \"$TDIR_PARENT\"; directory" \
"not writable"
fi
rm -rf "$TDIR"
### HEADER
# Because debconf hijacks standard output and its confmodule uses file
# descriptor 3 for its own purposes, we will write our output to file descriptor
# 4 instead of standard output.
exec 4>"$DEXCONFTMPDIR/Header"
cat >&4 <<SECTION
# xorg.conf.failsafe (X.Org X Window System server configuration file)
#
# This file was generated by dexconf, the Debian X Configuration tool, using
# values from the debconf database.
#
# Edit this file with caution, and see the xorg.conf manual page.
# (Type "man xorg.conf" at the shell prompt.)
#
# This file is automatically updated on xserver-xorg package upgrades *only*
# if it has not been modified since the last upgrade of the xserver-xorg
# package.
#
# If you have edited this file but would like it to be automatically updated
# again, run the following command:
# sudo dpkg-reconfigure -phigh xserver-xorg
SECTION
### DEVICE
db_get xserver-$SERVER/config/device/driver
DEVICE_DRIVER="$RET"
db_get xserver-$SERVER/config/device/bus_id
DEVICE_BUSID="$RET"
db_get xserver-$SERVER/config/device/use_fbdev
DEVICE_USE_FBDEV="$RET"
exec 4>"$DEXCONFTMPDIR/Device"
cat >&4 <<SECTION
Section "Device"
■Identifier■"Configured Video Device"
SECTION
if [ -n "$DEVICE_DRIVER" ]; then
printf "\tDriver\t\t\"$DEVICE_DRIVER\"\n" >&4
fi
PS3_FB=$(grep -i PS3 /proc/fb 2>/dev/null || true)
if [ -n "$PS3_FB" ]; then
printf "\tOption\t\t\"ShadowFB\"\t\t\"false\"\n" >&4
fi
if [ -n "$DEVICE_BUSID" ]; then
printf "\tBusID\t\t\"$DEVICE_BUSID\"\n" >&4
fi
if [ "$DEVICE_USE_FBDEV" = "true" ]; then
printf "\tOption\t\t\"UseFBDev\"\t\t\"$DEVICE_USE_FBDEV\"\n" >&4
fi
printf "EndSection\n" >&4
### MONITOR
exec 4>"$DEXCONFTMPDIR/Monitor"
cat >&4 <<SECTION
Section "Monitor"
■Identifier■"Configured Monitor"
SECTION
if [ -n "$QEMU_KVM" ]; then
printf "\tHorizSync\t30-70\n" >&4
printf "\tVertRefresh\t50-160\n" >&4
fi
cat >&4 <<SECTION
EndSection
SECTION
### SCREEN
exec 4>"$DEXCONFTMPDIR/Screen"
cat >&4 <<SECTION
Section "Screen"
■Identifier■"Default Screen"
■Monitor■■"Configured Monitor"
■Device■■"Configured Video Device"
SECTION
if [ -n "$PS3_FB" ]; then
printf "\tDefaultFbBpp 32\n" >&4
fi
if [ -n "$QEMU_KVM" ]; then
cat >&4 <<SUBSECTION
■DefaultDepth■24
■SubSection "Display"
■■Depth■24
■■Modes■"1280x800" "1152x768" "1024x768" "800x600" "640x480"
■EndSubSection
SUBSECTION
fi
printf "EndSection\n" >&4
# Write the configuration file. Put a blank line before every section we write
# except the first.
OUTFILE="$DEXCONFTMPDIR/dexconf-out"
umask 022
: >"$OUTFILE"
SPACER=
for SECTION in Header Files InputDeviceKeyboard InputDeviceMouse \
Device Monitor Screen; do
if [ -e "$DEXCONFTMPDIR/$SECTION" ]; then
eval $SPACER
cat "$DEXCONFTMPDIR/$SECTION" >>"$OUTFILE"
SPACER='echo "" >>"$OUTFILE"'
fi
done
BACKUP=
# Create a backup of the existing configuration file if it already exists.
if [ -e "$XF86CONFIG" ]; then
cat "$XF86CONFIG" >"$DEXCONFTMPDIR/backup"
BACKUP=true
fi
rm -rf "$DEXCONFTMPDIR"
exit 0
#!/bin/sh
#
# /etc/X11/Xsession
#
# global Xsession file -- used by display managers and xinit (startx)
set -e
PROGNAME=Xsession
message () {
# pretty-print messages of arbitrary length; use xmessage if it
# is available and $DISPLAY is set
MESSAGE="$PROGNAME: $*"
echo "$MESSAGE" | fold -s -w ${COLUMNS:-80} >&2
if [ -n "$DISPLAY" ] && which xmessage > /dev/null 2>&1; then
echo "$MESSAGE" | fold -s -w ${COLUMNS:-80} | xmessage -center -file -
fi
}
message_nonl () {
# pretty-print messages of arbitrary length (no trailing newline); use
# xmessage if it is available and $DISPLAY is set
MESSAGE="$PROGNAME: $*"
echo -n "$MESSAGE" | fold -s -w ${COLUMNS:-80} >&2;
if [ -n "$DISPLAY" ] && which xmessage > /dev/null 2>&1; then
echo -n "$MESSAGE" | fold -s -w ${COLUMNS:-80} | xmessage -center -file -
fi
}
errormsg () {
# exit script with error
message "$*"
exit 1
}
internal_errormsg () {
# exit script with error; essentially a "THIS SHOULD NEVER HAPPEN" message
# One big call to message() for the sake of xmessage; if we had two then
# the user would have dismissed the error we want reported before seeing the
# request to report it.
errormsg "$*" \
"Please report the installed version of the \"x11-common\"" \
"package and the complete text of this error message to" \
"<[email protected]>."
}
OPTIONFILE=/etc/X11/Xsession.options
SYSRESOURCES=/etc/X11/Xresources
USRRESOURCES=$HOME/.Xresources
SYSSESSIONDIR=/etc/X11/Xsession.d
USERXSESSION=$HOME/.xsession
USERXSESSIONRC=$HOME/.xsessionrc
ALTUSERXSESSION=$HOME/.Xsession
ERRFILE=$HOME/.xsession-errors
exit 0