This file is indexed.

/usr/sbin/Forcevideo-drbl-live is in drbl 2.6.15-1.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
#!/bin/bash
# Author: Steven Shiau <steven _at_ nchc org tw>
# License: GPL
# Description: From X version 7.3, "dpkg-reconfigure xserver-xorg" won't ask about VGA driver and screeen resolution, therefore we have to drop the "dpkg-reconfigure xserver-xorg" mechanism.
# Ref: http://forums.debian.net/viewtopic.php?t=26577

# Load DRBL setting and functions
DRBL_SCRIPT_PATH="${DRBL_SCRIPT_PATH:-/usr/share/drbl}"

. $DRBL_SCRIPT_PATH/sbin/drbl-conf-functions
[ -e /etc/drbl/drbl-ocs.conf ] && . /etc/drbl/drbl-ocs.conf
[ -e $DRBL_SCRIPT_PATH/sbin/ocs-functions ] && . $DRBL_SCRIPT_PATH/sbin/ocs-functions

# Load ocs_lang if it exists
[ -e /etc/ocs/ocs-live.conf ] && . /etc/ocs/ocs-live.conf

#
check_if_root

# Get the live media mount point.
get_live_media_mnt_point

#
ask_and_load_lang_set

#
if [ -z "$LIVE_MEDIA" -o ! -d "/$LIVE_MEDIA" ]; then
  echo "$0 should be run in DRBL Live!"
  echo "Program terminated!"
  exit 1
fi

#
if [ ! -e /etc/X11/X ]; then
  echo "No X program! Skip X configure!"
  exit 3
fi

# Default settings
xconf="/etc/X11/xorg.conf"
start_x="yes"

# functions
USAGE() {
    echo "Usage:"
    echo "To configure X config"
    echo "$0 [OPTION]"
    echo "OPTION:"
    echo "-s, --skip-start-x     After xorg.conf is created, skip asking if want to start X"
} # end of USAGE
# Check if root or not
check_if_root() {
   if [ ! "$UID" = "0" ]; then
     echo
     echo "[$LOGNAME] You need to run this script \"`basename $0`\" as root."
     echo
     exit 1
   fi
} # end of check_if_root
#
set_priority() {
  echo '*****************************************************'
  [ "$BOOTUP" = "color" ] && $SETCOLOR_WARNING
  echo "Which mode do you want when configuring X ?"
  [ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL
  echo "0: Beginner mode, use whatever the default priority of question is."
  echo "1: Medium mode."
  echo "2: Expert mode, very verbose."
  [ "$BOOTUP" = "color" ] && $SETCOLOR_WARNING
  echo "///NOTE/// If graphical environment (X-window) fails to start, you can:"
  [ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL
  echo "  (a): Run \"sudo $0\" to configure it again. Use '1: Medium mode' or '2: Expert mode', then say 'no' to 'Attempt to autodetect video buffer' so that you can choose 'vesa' as the X server driver. When 'Attempt monitor autodetection', say 'no' either so that you can choose 1024x768, 800x600 or 640x480 as your resolution. For the rest of settings, you can accept the default values if you have no idea about them."
  echo "  (b): Run \"sudo /etc/init.d/gdm restart\" to enter graphical environment."
  echo -n "[0] "
  read ans_ver
  case "$ans_ver" in
    # Beginner means only ask high priority question
    # Expert means ask low priority question
    1) PRIORITY="medium" ;;
    2) PRIORITY="low"    ;;
    *) PRIORITY="high"   ;;
  esac
} # end of set_priority
#
choose_resolution() {
  echo '*****************************************************'
  [ "$BOOTUP" = "color" ] && $SETCOLOR_WARNING
  echo "$msg_program_to_create_X_config_with_60_Hz"
  echo "$msg_which_resolution_do_u_want"
  [ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL
  echo "0: 640x480"
  echo "1: 800x600"
  echo "2: 1024x768"
  echo "3: 1152x864"
  echo "4: 1280x800"
  echo "5: 1280x960"
  echo "6: 1280x1024"
  echo "7: 1440x1080"
  echo -n "[2] "
  read ans_res
  case "$ans_res" in
    0) gtf_param="640 480 60"    
       pmode="640x480"
       ;;
    1) gtf_param="800 600 60" 
       pmode="800x600"
       ;;
    3) gtf_param="1152 864 60"   
       pmode="1152x864"
       ;;
    4) gtf_param="1280 800 60"   
       pmode="1280x800"
       ;;
    5) gtf_param="1280 960 60"   
       pmode="1280x960"
       ;;
    6) gtf_param="1280 1024 60"   
       pmode="1280x1024"
       ;;
    7) gtf_param="1440 1080 60"   
       pmode="1440x1080"
       ;;
    *) gtf_param="1024 768 60"   
       pmode="1024x768"
       ;;
  esac
  echo '*****************************************************'
  [ "$BOOTUP" = "color" ] && $SETCOLOR_WARNING
  echo "$msg_which_vga_card_driver"
  [ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL
  echo -n "[vesa] "
  read ans_vga
  case "$ans_vga" in
    "") vga_driver="vesa" ;;
    *) vga_driver="$ans_vga"  ;;
  esac
  echo '*****************************************************'
  [ "$BOOTUP" = "color" ] && $SETCOLOR_WARNING
  echo "$msg_which_color_depth_do_u_want"
  [ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL
  echo "0: 24"
  echo "1: 16"
  echo "2: 15"
  echo "3: 8"
  echo -n "[0] "
  read ans_dep
  case "$ans_dep" in
    1) depth="16" ;;
    2) depth="15" ;;
    3) depth="8"  ;;
    *) depth="24" ;;
  esac
} # end of choose_resolution
#
gen_xorg.conf() {
cat <<-XCONF_END > $xconf
# xorg.conf (X.Org X Window System server configuration file)
#
# This file was generated by DRBL live.
#
# Edit this file with caution, and see the xorg.conf manual page.

Section "InputDevice"
        # ///NOTE/// The keyboard layout will be overwritten when enter X by loadkey command. Therefore here this section is useless. Just for the X to start normally.
        Identifier	"Generic Keyboard"
        Driver		"kbd"
        Option		"XkbRules"	"xorg"
        Option		"XkbModel"	"pc104"
        Option		"XkbLayout"	"us"
EndSection

Section "InputDevice"
        Identifier	"Configured Mouse"
        Driver		"mouse"
EndSection

Section "Device"
        Identifier	"Configured Video Device"
XCONF_END

cat <<-XCONF_END >> $xconf
        Driver		"$vga_driver"
EndSection

XCONF_END

cat <<-XCONF_END >> $xconf
Section "Monitor"
        Identifier	"Configured Monitor"
XCONF_END

gtf $gtf_param  >> $xconf

cat <<-XCONF_END >> $xconf
        Option      "PreferredMode"      "$pmode"
XCONF_END

cat <<-XCONF_END >> $xconf
EndSection

Section "Screen"
        Identifier	"Default Screen"
        Monitor		"Configured Monitor"
        DefaultDepth   $depth 
        SubSection "Display"
                    Depth   $depth
                    Modes   "$pmode"
        EndSubSection
EndSection

XCONF_END
} # end of gen_xorg.conf
#
reconfig_Xorg() {
  local xver RC
  xver="$(dpkg-query -W  --showformat '${Version}\n' xserver-xorg | awk -F":" '{print $2}')"
  # Ref: https://bugs.launchpad.net/bugs/207409
  if dpkg --compare-versions "$xver" ">=" "7.3"; then
    choose_resolution
    gen_xorg.conf
    echo "$xconf was created."
    [ -e "$xconf" ] && RC=0
  else
    # For old version, we can use dpkg-reconfigure xserver-xorg
    set_priority
    echo -n "Running \"dpkg-reconfigure --priority=$PRIORITY xserver-xorg\"... "
    LC_ALL=C dpkg-reconfigure --priority=$PRIORITY xserver-xorg
    RC=$?
  fi
  if [ "$RC" -eq 0 ]; then
    echo "X is now configured."
  else
    [ "$BOOTUP" = "color" ] && $SETCOLOR_FAILURE
    echo "Failed to configure X config file."
    [ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL
    echo "$msg_program_stop"
    exit 1
  fi
} # end of reconfig_Xorg

############
### MAIN ###
############

check_if_root

#
while [ $# -gt 0 ]; do
  case "$1" in
    -s|--skip-start-x)
	    start_x="no"
            shift ;;
    -*)     echo "${0}: ${1}: invalid option" >&2
            USAGE >& 2
            exit 2 ;;
    *)      break ;;
  esac
done

# Clean the old config if exists before reconfigure. It must be empty otherwise the setting we append won't work.
rm -f $xconf
reconfig_Xorg

#
if [ "$start_x" = "yes" ]; then
  echo '*****************************************************'
  [ "$BOOTUP" = "color" ] && $SETCOLOR_WARNING
  echo "Do you want to run \"sudo /etc/init.d/gdm restart\" to enter graphical environment ?"
  [ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL
  echo -n "[Y/n] "
  read enter_X
  case "$enter_X" in
    n|N|[nN][oO])
       exit 1
       ;;
    *)
       sudo /etc/init.d/gdm restart
       ;;
  esac
fi