VirtualBox

Changeset 43796 in vbox for trunk/src/VBox/Installer


Ignore:
Timestamp:
Nov 2, 2012 11:39:25 AM (12 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
81781
Message:

Installer/linux: add post command and a couple of adjustments to headless X.Org script.

Location:
trunk/src/VBox/Installer/linux
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Installer/linux/VBoxHeadlessXOrg.sh

    r43704 r43796  
    8181The optional configuration file should contain a series of lines of the form
    8282"KEY=value".  It will be read in as a command shell sub-script.  Here is the
    83 current list of possible key settings with a short explanation.
     83current list of possible key settings with a short explanation.  Usually it
     84should be sufficient to change the value of \${HEADLESS_X_ORG_USERS} and to
     85leave all other settings unchanged.
    8486
    8587  HEADLESS_X_ORG_CONFIGURATION_FOLDER
     
    100102    repeated at regular intervals until it returns successfully, so a command
    101103    which can be executed internally be the shell (like "[") is preferable.
     104    The default command waits until the udev event queue has settled.
     105
     106  HEADLESS_X_ORG_USERS
     107    List of users who will have access to the X servers started and for whom we
     108    will provide the configuration details via VirtualBox extra data.  This
     109    variable is only used by the commands in the default configuration
     110    (\${HEADLESS_X_ORG_SERVER_PRE_COMMAND} and
     111    \${HEADLESS_X_ORG_SERVER_POST_COMMAND}), and not by the service itself.
    102112
    103113  HEADLESS_X_ORG_SERVER_PRE_COMMAND
    104114    Command to execute once to perform any set-up needed before starting the
    105     X servers, such as setting up the X server authentication.
     115    X servers, such as setting up the X server authentication.  The default
     116    command creates an authority file for each of the users in the list
     117    \${HEADLESS_X_ORG_USERS}.
    106118
    107119  HEADLESS_X_ORG_SERVER_COMMAND
     
    112124      HEADLESS_X_ORG_SERVER_COMMAND="Xorg :\${screen} [...] > \"\${log_file}\"
    113125
     126  HEADLESS_X_ORG_SERVER_POST_COMMAND
     127    Command to execute once the X servers have been successfully started.  By
     128    default this stores the service configuration information to VirtualBox
     129    extra data for each of the users in the list \${HEADLESS_X_ORG_USERS}.
     130
    114131  HEADLESS_X_ORG_SERVER_LOG_FILE_TEMPLATE
    115     The default X server log file name, containing the variable "${screen}" for
     132    The default X server log file name, containing the variable "\${screen}" for
    116133    the screen number.  The variable must be quoted for expansion at evaluation
    117134    time, e.g.
     
    125142HEADLESS_X_ORG_LOG_FILE="${SERVICE_NAME}.log"
    126143HEADLESS_X_ORG_RUN_FOLDER="/var/run/${SERVICE_NAME}"
    127 HEADLESS_X_ORG_CHECK_PREREQUISITES="[ -e /dev/dri/card0 ]"
     144HEADLESS_X_ORG_CHECK_PREREQUISITES="udevadm settle || ! udevadm -V"
    128145X_AUTH_FILE="${HEADLESS_X_ORG_RUN_FOLDER}/xauth"
    129 HEADLESS_X_ORG_SERVER_PRE_COMMAND="echo > \"${X_AUTH_FILE}\"; xauth -f \"${X_AUTH_FILE}\" add :0 . \"\$(dd if=/dev/urandom count=1 bs=16 2>/dev/null | od -An -x)\""
     146HEADLESS_X_ORG_SERVER_PRE_COMMAND="echo > \"${X_AUTH_FILE}\"; xauth -f \"${X_AUTH_FILE}\" add :0 . \"\$(dd if=/dev/urandom count=1 bs=16 2>/dev/null | od -An -x)\"; for i in ${HEADLESS_X_ORG_USERS}; do cp \"${X_AUTH_FILE}\" \"${X_AUTH_FILE}.${i}\"; chown \"${i}\" \"${X_AUTH_FILE}.${i}\"; done"
    130147HEADLESS_X_ORG_SERVER_COMMAND="Xorg :\${screen} -auth \"${HEADLESS_X_ORG_RUN_FOLDER}/xauth\" -config \"\${conf_file}\" -logverbose 0 -logfile /dev/null -verbose 7 > \"\${log_file}\" 2>&1"
    131148HEADLESS_X_ORG_SERVER_LOG_FILE_TEMPLATE="Xorg.\${screen}.log"
     
    245262  space=" "
    246263done
     264
     265# Do any post-start work.
     266eval "${HEADLESS_X_ORG_SERVER_POST_COMMAND}"
     267
    247268wait
  • trunk/src/VBox/Installer/linux/testcase/tstHeadlessXOrg.sh

    r43795 r43796  
    264264expect_exit "${PID}" 5 test_pre_command
    265265rm -f "${XORG_FOLDER}"/xorg.conf.* "${TEST_FOLDER}"/run/pre*
     266
     267# Set up our post-command test configuration file.
     268create_basic_configuration_file "${TEST_FOLDER}/conf" "${TEST_FOLDER}"
     269cat >> "${TEST_FOLDER}/conf" << EOF
     270HEADLESS_X_ORG_SERVER_COMMAND="rm -f \"${TEST_FOLDER}/run/post\""
     271HEADLESS_X_ORG_SERVER_POST_COMMAND="touch \"${TEST_FOLDER}/run/post\""
     272EOF
     273
     274# Post-command test.
     275print_line "post-command test"
     276touch "${XORG_FOLDER}/xorg.conf.2"
     277touch "${XORG_FOLDER}/xorg.conf.4"
     278
     279test_post_command()
     280{
     281  STATUS="$1"
     282  case "${STATUS}" in
     283  0)
     284    LOG_FOLDER="${TEST_FOLDER}/log"
     285    LOG="${LOG_FOLDER}/log"
     286    if [ -e "${TEST_FOLDER}/run/post" ]; then
     287      printf "SUCCESS.\n"
     288    else
     289      printf "\nFAILED: post-command not executed.\n"
     290    fi
     291    ;;
     292  *)
     293    printf "\nFAILED: exit status ${STATUS}.\n"
     294  esac
     295}
     296
     297rm -f "${TEST_FOLDER}/run/post"
     298./VBoxHeadlessXOrg.sh -c "${TEST_FOLDER}/conf" &
     299PID=$!
     300expect_exit "${PID}" 5 test_post_command
     301rm -f "${XORG_FOLDER}"/xorg.conf.* "${TEST_FOLDER}/run/post"
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette