Changeset 68075 in vbox
- Timestamp:
- Jul 21, 2017 9:25:38 AM (7 years ago)
- Location:
- trunk/src/VBox/Main/UnattendedTemplates
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/UnattendedTemplates/debian_postinstall.sh
r68071 r68075 3 3 # Post installation script template for debian-like distros. 4 4 # 5 # This script expects to be running chroot'ed into /target.5 # This script expects to be running w/o chroot. 6 6 # 7 7 … … 18 18 # 19 19 20 MY_LOGFILE="/var/log/vboxpostinstall.log" 20 #MY_DEBUG="yes" 21 MY_DEBUG="" 22 MY_TARGET="/target" 23 MY_LOGFILE="${MY_TARGET}/var/log/vboxpostinstall.log" 21 24 MY_EXITCODE=0 22 25 … … 24 27 log_command() 25 28 { 26 echo "Executing: $*" >> "${MY_LOGFILE}" 29 echo "--------------------------------------------------" >> "${MY_LOGFILE}" 30 echo "** Date: `date -R`" >> "${MY_LOGFILE}" 31 echo "** Executing: $*" >> "${MY_LOGFILE}" 27 32 "$@" 2>&1 | tee -a "${MY_LOGFILE}" 28 33 if [ "${PIPESTATUS[0]}" != "0" ]; then … … 32 37 } 33 38 39 log_command_in_target() 40 { 41 # 42 # We should be using in-target here, however we don't get any stderr output 43 # from it because of log-output. We can get stdout by --pass-stdout, but 44 # that's not helpful for failures. 45 # 46 # So, we try do the chroot prepping that in-target does at the start of the 47 # script (see below) and just use chroot here. 48 # 49 # Also, GA installer and in-root/log-output doesn't seem to get along. 50 # 51 log_command chroot "${MY_TARGET}" "$@" 52 # log_command in-target --pass-stdout "$@" # No stderr output... :-( 53 } 34 54 35 echo "Started: $*" >> "${MY_LOGFILE}"36 echo "Date: `date -R`" >> "${MY_LOGFILE}"37 55 38 echo '' 39 echo 'Installing packages for building kernel modules...' 40 log_command apt-get -y install build-essential 41 log_command apt-get -y install linux-headers-$(uname -r) 56 # 57 # Header. 58 # 59 echo "******************************************************************************" >> "${MY_LOGFILE}" 60 echo "** VirtualBox Unattended Guest Installation - Late installation actions" >> "${MY_LOGFILE}" 61 echo "** Date: `date -R`" >> "${MY_LOGFILE}" 62 echo "** Started: $0 $*" >> "${MY_LOGFILE}" 42 63 64 # 65 # Setup the target jail ourselves since in-target steals all the output. 66 # 67 if [ -f /lib/chroot-setup.sh ]; then 68 MY_HAVE_CHROOT_SETUP="yes" 69 . /lib/chroot-setup.sh 70 if chroot_setup; then 71 echo "** chroot_setup: done" | tee -a "${MY_LOGFILE}" 72 else 73 echo "** chroot_setup: failed $?" | tee -a "${MY_LOGFILE}" 74 fi 75 else 76 MY_HAVE_CHROOT_SETUP="" 77 fi 78 79 # 80 # Debug 81 # 82 if [ "${MY_DEBUG}" = "yes" ]; then 83 log_command id 84 log_command df 85 log_command mount 86 log_command_in_target df 87 log_command_in_target mount 88 log_command_in_target ls -Rla /cdrom 89 log_command_in_target ls -Rla /media 90 log_command find / 91 MY_EXITCODE=0 92 fi 93 94 # We want the ISO available inside the target jail. 95 if [ -f "${MY_TARGET}/cdrom/vboxpostinstall.sh" ]; then 96 MY_UNMOUNT_TARGET_CDROM= 97 echo "** binding cdrom into jail: already done" | tee -a "${MY_LOGFILE}" 98 else 99 MY_UNMOUNT_TARGET_CDROM="yes" 100 log_command mount -o bind /cdrom "${MY_TARGET}/cdrom" 101 if [ -f "${MY_TARGET}/cdrom/vboxpostinstall.sh" ]; then 102 echo "** binding cdrom into jail: success" | tee -a "${MY_LOGFILE}" 103 else 104 echo "** binding cdrom into jail: failed" | tee -a "${MY_LOGFILE}" 105 fi 106 if [ "${MY_DEBUG}" = "yes" ]; then 107 log_command find "${MY_TARGET}/cdrom" 108 fi 109 fi 110 111 # 112 # Packages needed for GAs. 113 # 114 echo '** Installing packages for building kernel modules...' | tee -a "${MY_LOGFILE}" 115 log_command_in_target apt-get -y install build-essential 116 log_command_in_target apt-get -y install linux-headers-$(uname -r) 117 118 # 119 # GAs 120 # 43 121 @@VBOX_COND_IS_INSTALLING_ADDITIONS@@ 44 echo '' 45 echo 'Installing VirtualBox Guest Additions...' 46 log_command /bin/bash /cdrom/VBoxAdditions/VBoxLinuxAdditions.run 47 log_command usermod -a -G vboxsf "@@VBOX_INSERT_USER_LOGIN@@" 122 echo '** Installing VirtualBox Guest Additions...' | tee -a "${MY_LOGFILE}" 123 log_command_in_target /bin/bash /cdrom/vboxadditions/VBoxLinuxAdditions.run --nox11 124 log_command_in_target usermod -a -G vboxsf "@@VBOX_INSERT_USER_LOGIN@@" 48 125 @@VBOX_COND_END@@ 49 126 127 # 128 # Testing. 129 # 50 130 @@VBOX_COND_IS_INSTALLING_TEST_EXEC_SERVICE@@ 51 echo ' '52 echo 'Installing Test Execution Service...' 131 echo '** Installing Test Execution Service...' | tee -a "${MY_LOGFILE}" 132 log_command_in_target test "/cdrom/linux/@@VBOX_INSERT_OS_ARCH@@/TestExecService" 53 133 ## @todo fix this 54 134 @@VBOX_COND_END@@ 55 135 56 echo "Final exit code: ${MY_EXITCODE}" >> "${MY_LOGFILE}" 136 # 137 # Run user command. 138 # 139 @@VBOX_COND_HAS_POST_INSTALL_COMMAND@@ 140 echo '** Running custom user command ...' | tee -a "${MY_LOGFILE}" 141 log_command @@VBOX_INSERT_POST_INSTALL_COMMAND@@ 142 @@VBOX_COND_END@@ 143 144 # 145 # Unmount the cdrom if we bound it and clean up the chroot if we set it up. 146 # 147 if [ -n "${MY_UNMOUNT_TARGET_CDROM}" ]; then 148 echo "** unbinding cdrom from jail..." | tee -a "${MY_LOGFILE}" 149 log_command umount "${MY_TARGET}/cdrom" 150 fi 151 if [ -n "${MY_HAVE_CHROOT_SETUP}" ]; then 152 if chroot_cleanup; then 153 echo "** chroot_cleanup: done" | tee -a "${MY_LOGFILE}" 154 else 155 echo "** chroot_cleanup: failed $?" | tee -a "${MY_LOGFILE}" 156 fi 157 fi 158 159 # 160 # Footer. 161 # 162 echo "******************************************************************************" >> "${MY_LOGFILE}" 163 echo "** Date: `date -R`" >> "${MY_LOGFILE}" 164 echo "** Final exit code: ${MY_EXITCODE}" >> "${MY_LOGFILE}" 165 echo "******************************************************************************" >> "${MY_LOGFILE}" 166 57 167 exit ${MY_EXITCODE} 58 168 -
trunk/src/VBox/Main/UnattendedTemplates/debian_preseed.cfg
r68071 r68075 64 64 d-i preseed/late_command string cp /cdrom/vboxpostinstall.sh /target/root/vboxpostinstall.sh \ 65 65 && chmod +x /target/root/vboxpostinstall.sh \ 66 && chroot /target/bin/bash /root/vboxpostinstall.sh66 && /bin/bash /root/vboxpostinstall.sh 67 67 -
trunk/src/VBox/Main/UnattendedTemplates/ubuntu_preseed.cfg
r68071 r68075 64 64 d-i preseed/late_command string cp /cdrom/vboxpostinstall.sh /target/root/vboxpostinstall.sh \ 65 65 && chmod +x /target/root/vboxpostinstall.sh \ 66 && chroot /target/bin/bash /root/vboxpostinstall.sh66 && /bin/bash /root/vboxpostinstall.sh 67 67 68 68 # Same as above, but for ubiquity. 69 69 ubiquity ubiquity/success_command string cp /cdrom/vboxpostinstall.sh /target/root/vboxpostinstall.sh \ 70 70 && chmod +x /target/root/vboxpostinstall.sh \ 71 && chroot /target /bin/bash/root/vboxpostinstall.sh71 && /bin/bash /target/root/vboxpostinstall.sh 72 72
Note:
See TracChangeset
for help on using the changeset viewer.