VirtualBox

Changeset 75580 in vbox for trunk/src/VBox/HostDrivers


Ignore:
Timestamp:
Nov 19, 2018 3:40:15 PM (6 years ago)
Author:
vboxsync
Message:

HostDrivers/export_modules.sh: allow export to archive or folder.
bugref: 9165: webtools: create scripts for (re-)creating chroot build jails
Similar to a previous change to the guest export_modules.sh: we now have
--file and --folder options to export either to a tar.gz archive or to a
folder in the file system, for use with test builds in chroots. Also clean
up parameter handling.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostDrivers/linux/export_modules.sh

    r69500 r75580  
    3030MY_DIR="${TARGET%/[!/]*}"
    3131
    32 if [ -z "$1" ]; then
    33     echo "Usage: $0 <filename.tar.gz> [--without-hardening]"
    34     echo "  Export VirtualBox kernel modules to <filename.tar.gz>"
     32# What this script does:
     33usage_msg="\
     34Usage: `basename ${0}` --file <path>|--folder <path> [--without-hardening]
     35
     36Exports the VirtualBox host kernel modules to the tar.gz archive or folder in \
     37<path>, optionally adjusting the Make files to build them without hardening.
     38
     39Examples:
     40  `basename ${0}` --file /tmp/vboxhost.tar.gz
     41  `basename ${0}` --folder /tmp/tmpdir --without-hardening"
     42
     43usage()
     44{
     45    case "${1}" in
     46    0)
     47        echo "${usage_msg}" | fold -s -w80 ;;
     48    *)
     49        echo "${usage_msg}" | fold -s -w80 >&2 ;;
     50    esac
     51    exit "${1}"
     52}
     53
     54fail()
     55{
     56    echo "${1}" | fold -s -w80 >&2
    3557    exit 1
    36 fi
    37 
     58}
     59
     60unset FILE FOLDER
    3861VBOX_WITH_HARDENING=1
    39 if [ "$2" = "--without-hardening" ]; then
    40     VBOX_WITH_HARDENING=
    41 fi
    42 
    43 PATH_TMP="`cd \`dirname $1\`; pwd`/.vbox_modules"
     62while test -n "${1}"; do
     63    case "${1}" in
     64    --file)
     65        FILE="${2}"
     66        shift 2 ;;
     67    --folder)
     68        FOLDER="${2}"
     69        shift 2 ;;
     70    --without-hardening)
     71        unset VBOX_WITH_HARDENING
     72        shift ;;
     73    -h|--help)
     74        usage 0 ;;
     75    *)
     76        echo "Unknown parameter ${1}" >&2
     77        usage 1 ;;
     78    esac
     79done
     80test -z "$FILE" || test -z "$FOLDER" ||
     81    fail "Only one of --file and --folder may be used"
     82test -n "$FILE" || test -n "$FOLDER" || usage 1
     83
     84if test -n "$FOLDER"; then
     85    PATH_TMP="$FOLDER"
     86else
     87    PATH_TMP="`cd \`dirname $FILE\`; pwd`/.vbox_modules"
     88    FILE_OUT="`cd \`dirname $FILE\`; pwd`/`basename $FILE`"
     89fi
    4490PATH_OUT=$PATH_TMP
    45 FILE_OUT="`cd \`dirname $1\`; pwd`/`basename $1`"
    4691PATH_ROOT="`cd ${MY_DIR}/../../../..; pwd`"
    4792PATH_LOG=/tmp/vbox-export-host.log
     
    64109
    65110# Temporary path for creating the modules, will be removed later
     111rm -rf "$PATH_TMP"
    66112mkdir $PATH_TMP || exit 1
    67113
     
    160206rm $PATH_TMP/product-generated.h
    161207
     208# If we are exporting to a folder then stop now.
     209test -n "SFOLDER" && exit 0
     210
    162211# Do a test build
    163212echo Doing a test build, this may take a while.
Note: See TracChangeset for help on using the changeset viewer.

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