Changeset 68160 in vbox
- Timestamp:
- Jul 28, 2017 2:49:13 PM (8 years ago)
- svn:sync-xref-src-repo-rev:
- 117250
- Location:
- trunk/src/VBox/Main/UnattendedTemplates
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/UnattendedTemplates/debian_postinstall.sh
r68087 r68160 212 212 test -d "${MY_TARGET}/usr/lib/systemd/system" && MY_UNIT_PATH="${MY_TARGET}/usr/lib/systemd/system" 213 213 if [ -d "${MY_UNIT_PATH}" ]; then 214 if [ -f "${MY_TARGET}/linux/vboxtxs.service" ]; then ## REMOVE AS SOON AS r117117 IS READY 215 log_command cp "${MY_TARGET}/linux/vboxtxs.service" "${MY_UNIT_PATH}/vboxtxs.service" 216 else ## REMOVE AS SOON AS r117117 IS READY 217 cat > "${MY_UNIT_PATH}/vboxtxs.service" <<EOF 218 [Unit] 219 Description=VirtualBox Test Execution Service 220 SourcePath=/root/validationkit/linux/vboxtxs 221 222 [Service] 223 Type=forking 224 Restart=no 225 TimeoutSec=5min 226 IgnoreSIGPIPE=no 227 KillMode=process 228 GuessMainPID=no 229 RemainAfterExit=yes 230 ExecStart=/root/validationkit/linux/vboxtxs start 231 ExecStop=/root/validationkit/linux/vboxtxs stop 232 233 [Install] 234 WantedBy=multi-user.target 235 EOF 236 fi 214 log_command cp "${MY_TARGET}/linux/vboxtxs.service" "${MY_UNIT_PATH}/vboxtxs.service" 237 215 log_command chmod 644 "${MY_UNIT_PATH}/vboxtxs.service" 238 216 log_command_in_target systemctl -q enable vboxtxs 239 217 240 # Not systemd .Add support for upstart later...218 # Not systemd: Add support for upstart later... 241 219 else 242 220 echo "** error: No systemd unit dir found. Using upstart or something?" | tee -a "${MY_LOGFILE}" … … 275 253 fi 276 254 255 277 256 # 278 257 # Log footer. -
trunk/src/VBox/Main/UnattendedTemplates/fedora_ks.cfg
r68148 r68160 24 24 25 25 # System language 26 lang en_US26 lang @@VBOX_INSERT_LOCALE@@ 27 27 28 28 # SELinux configuration … … 33 33 34 34 # System timezone 35 timezone Europe/London35 timezone --utc @@VBOX_INSERT_TIME_ZONE_UX@@ 36 36 37 37 # Network information 38 network --bootproto=dhcp --device=eth0 --onboot=on 38 network --bootproto=dhcp --device=eth0 --onboot=on --hostname=@@VBOX_INSERT_HOSTNAME_FQDN_SH@@ 39 39 40 40 # System bootloader configuration … … 44 44 # Partition clearing information 45 45 clearpart --all --initlabel 46 46 47 # Disk partitioning information 47 48 part / --fstype ext4 --size 6000 --grow --asprimary … … 52 53 53 54 # Reboot after installation 54 reboot 55 # Note! the --eject option requires Fedora 6 or later. Doesn't seem to work tough. 56 # Note! doesn't really work. Maybe related to https://bugzilla.redhat.com/show_bug.cgi?id=810553 ?? 57 reboot --eject 55 58 56 %packages 59 # Packages. We currently ignore missing packages/groups here to keep things simpler. 60 %packages --ignoremissing 57 61 @@VBOX_COND_IS_NOT_MINIMAL_INSTALLATION@@ 58 62 @standard … … 61 65 @core 62 66 @@VBOX_COND_END@@ 67 68 # Prepare building the additions kernel module, try get what we can from the cdrom: 69 kernel-headers 70 kernel-devel 71 glibc-devel 72 glibc-headers 73 gcc 74 dkms 75 make 76 bzip2 77 perl 78 63 79 %end 64 80 65 %post --log=/root/ks-post.log 66 yum -y install "kernel-devel-$(uname -r)" 67 yum -y install gcc 81 # Post install happens in a different script. 82 %post --nochroot --log=/mnt/sysimage/root/ks-post.log 83 cp /run/install/repo/vboxpostinstall.sh /mnt/sysimage/root/vboxpostinstall.sh 84 chmod a+x /mnt/sysimage/root/vboxpostinstall.sh 85 /bin/bash /mnt/sysimage/root/vboxpostinstall.sh --fedora 68 86 69 @@VBOX_COND_IS_INSTALLING_ADDITIONS@@ 70 ## @todo fix this. 71 cp /cdrom/vboxpostinstall.sh /root/vboxpostinstall.sh && chmod a+x /root/vboxpostinstall.sh && /bin/bash /root/vboxpostinstall.sh 72 @@VBOX_COND_END@@ 73 eject /dev/sr0 74 eject /dev/sr1 75 eject /dev/sr2 76 init 5 87 # eject /dev/sr0 - this causes reboot trouble with fedora 26, and is documented to no be a good idea... 88 # init 5 89 77 90 %end 78 91 -
trunk/src/VBox/Main/UnattendedTemplates/redhat_postinstall.sh
r68071 r68160 1 1 #!/bin/bash 2 2 ## @file 3 # Post installation script template for redhat- likedistros.4 # 5 # This script expects to be running chroot'ed into /target.3 # Post installation script template for redhat- distros. 4 # 5 # Note! This script expects to be running chrooted (inside new sytem). 6 6 # 7 7 … … 18 18 # 19 19 20 MY_LOGFILE="/var/log/vboxpostinstall.log" 20 21 # 22 # Globals. 23 # 24 MY_TARGET="/mnt/sysimage" 25 MY_LOGFILE="${MY_TARGET}/var/log/vboxpostinstall.log" 26 MY_CDROM_NOCHROOT="/run/install/repo" 21 27 MY_EXITCODE=0 28 MY_DEBUG="" # "yes" 29 30 31 # 32 # Do we need to exec using target bash? If so, we must do that early 33 # or ash will bark 'bad substitution' and fail. 34 # 35 if [ "$1" = "--need-target-bash" ]; then 36 # Try figure out which directories we might need in the library path. 37 if [ -z "${LD_LIBRARY_PATH}" ]; then 38 LD_LIBRARY_PATH="${MY_TARGET}/lib" 39 fi 40 for x in \ 41 ${MY_TARGET}/lib \ 42 ${MY_TARGET}/usr/lib \ 43 ${MY_TARGET}/lib/*linux-gnu/ \ 44 ${MY_TARGET}/lib32/ \ 45 ${MY_TARGET}/lib64/ \ 46 ${MY_TARGET}/usr/lib/*linux-gnu/ \ 47 ${MY_TARGET}/usr/lib32/ \ 48 ${MY_TARGET}/usr/lib64/ \ 49 ; 50 do 51 if [ -e "$x" ]; then LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${x}"; fi; 52 done 53 export LD_LIBRARY_PATH 54 55 # Append target bin directories to the PATH as busybox may not have tee. 56 PATH="${PATH}:${MY_TARGET}/bin:${MY_TARGET}/usr/bin:${MY_TARGET}/sbin:${MY_TARGET}/usr/sbin" 57 export PATH 58 59 # Drop the --need-target-bash argument and re-exec. 60 shift 61 echo "******************************************************************************" >> "${MY_LOGFILE}" 62 echo "** Relaunching using ${MY_TARGET}/bin/bash $0 $*" >> "${MY_LOGFILE}" 63 echo "** LD_LIBRARY_PATH=${LD_LIBRARY_PATH}" >> "${MY_LOGFILE}" 64 echo "** PATH=${PATH}" >> "${MY_LOGFILE}" 65 exec "${MY_TARGET}/bin/bash" "$0" "$@" 66 fi 67 68 69 # 70 # Commands. 71 # 22 72 23 73 # Logs execution of a command. 24 74 log_command() 25 75 { 26 echo "Executing: $*" >> "${MY_LOGFILE}" 76 echo "--------------------------------------------------" >> "${MY_LOGFILE}" 77 echo "** Date: `date -R`" >> "${MY_LOGFILE}" 78 echo "** Executing: $*" >> "${MY_LOGFILE}" 27 79 "$@" 2>&1 | tee -a "${MY_LOGFILE}" 28 if [ "${PIPESTATUS[0]}" != "0" ]; then 29 echo "exit code: ${PIPESTATUS[0]}" 30 MY_EXITCODE=1; 80 MY_TMP_EXITCODE="${PIPESTATUS[0]}" 81 if [ "${MY_TMP_EXITCODE}" != "0" ]; then 82 if [ "${MY_TMP_EXITCODE}" != "${MY_IGNORE_EXITCODE}" ]; then 83 echo "** exit code: ${MY_TMP_EXITCODE}" | tee -a "${MY_LOGFILE}" 84 MY_EXITCODE=1; 85 else 86 echo "** exit code: ${MY_TMP_EXITCODE} (ignored)" | tee -a "${MY_LOGFILE}" 87 fi 31 88 fi 32 89 } 33 90 34 35 echo "Started: $*" >> "${MY_LOGFILE}" 36 echo "Date: `date -R`" >> "${MY_LOGFILE}" 37 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) 42 # 43 91 # Logs execution of a command inside the target. 92 log_command_in_target() 93 { 94 log_command chroot "${MY_TARGET}" "$@" 95 } 96 97 98 # 99 # Log header. 100 # 101 echo "******************************************************************************" >> "${MY_LOGFILE}" 102 echo "** VirtualBox Unattended Guest Installation - Late installation actions" >> "${MY_LOGFILE}" 103 echo "** Date: `date -R`" >> "${MY_LOGFILE}" 104 echo "** Started: $0 $*" >> "${MY_LOGFILE}" 105 106 107 # 108 # We want the ISO available inside the target jail. 109 # 110 if [ -d "${MY_TARGET}/cdrom" ]; then 111 MY_RMDIR_TARGET_CDROM= 112 else 113 MY_RMDIR_TARGET_CDROM="yes" 114 log_command mkdir -p ${MY_TARGET}/cdrom 115 fi 116 117 if [ -f "${MY_TARGET}/cdrom/vboxpostinstall.sh" ]; then 118 MY_UNMOUNT_TARGET_CDROM= 119 echo "** binding cdrom into jail: already done" | tee -a "${MY_LOGFILE}" 120 else 121 MY_UNMOUNT_TARGET_CDROM="yes" 122 log_command mount -o bind "${MY_CDROM_NOCHROOT}" "${MY_TARGET}/cdrom" 123 if [ -f "${MY_TARGET}/cdrom/vboxpostinstall.sh" ]; then 124 echo "** binding cdrom into jail: success" | tee -a "${MY_LOGFILE}" 125 else 126 echo "** binding cdrom into jail: failed" | tee -a "${MY_LOGFILE}" 127 fi 128 if [ "${MY_DEBUG}" = "yes" ]; then 129 log_command find "${MY_TARGET}/cdrom" 130 fi 131 fi 132 133 134 # 135 # Debug 136 # 137 if [ "${MY_DEBUG}" = "yes" ]; then 138 log_command id 139 log_command ps 140 log_command ps auxwwwf 141 log_command env 142 log_command df 143 log_command mount 144 log_command_in_target df 145 log_command_in_target mount 146 #log_command find / 147 MY_EXITCODE=0 148 fi 149 150 151 # 152 # Packages needed for GAs. 153 # 154 echo "--------------------------------------------------" >> "${MY_LOGFILE}" 155 echo '** Installing packages for building kernel modules...' | tee -a "${MY_LOGFILE}" 156 log_command_in_target yum -y install "kernel-devel-$(uname -r)" 157 log_command_in_target yum -y install "kernel-headers-$(uname -r)" 158 log_command_in_target yum -y install gcc 159 log_command_in_target yum -y install binutils 160 log_command_in_target yum -y install make 161 log_command_in_target yum -y install dkms 162 log_command_in_target yum -y install make 163 log_command_in_target yum -y install gzip2 164 log_command_in_target yum -y install perl 165 166 167 # 168 # GAs 169 # 44 170 @@VBOX_COND_IS_INSTALLING_ADDITIONS@@ 45 echo '' 46 echo 'Installing VirtualBox Guest Additions...' 47 ## @todo fix this 48 log_command /bin/bash /cdrom/VBoxAdditions/VBoxLinuxAdditions.run 49 log_command usermod -a -G vboxsf "@@VBOX_INSERT_USER_LOGIN@@" 171 echo "--------------------------------------------------" >> "${MY_LOGFILE}" 172 echo '** Installing VirtualBox Guest Additions...' | tee -a "${MY_LOGFILE}" 173 MY_IGNORE_EXITCODE=2 # returned if modules already loaded and reboot required. 174 log_command_in_target /bin/bash /cdrom/vboxadditions/VBoxLinuxAdditions.run --nox11 175 MY_IGNORE_EXITCODE= 176 log_command_in_target usermod -a -G vboxsf "@@VBOX_INSERT_USER_LOGIN@@" 50 177 @@VBOX_COND_END@@ 51 178 179 180 # 181 # Test Execution Service. 182 # 52 183 @@VBOX_COND_IS_INSTALLING_TEST_EXEC_SERVICE@@ 53 echo '' 54 echo 'Installing Test Execution Service...' 55 ## @todo fix this 184 echo "--------------------------------------------------" >> "${MY_LOGFILE}" 185 echo '** Installing Test Execution Service...' | tee -a "${MY_LOGFILE}" 186 log_command_in_target test "${MY_CDROM_NOCHROOT}/vboxvalidationkit/linux/@@VBOX_INSERT_OS_ARCH@@/TestExecService" 187 log_command mkdir -p "${MY_TARGET}/root/validationkit" "${MY_TARGET}/target/cdrom" 188 log_command cp -R ${MY_CDROM_NOCHROOT}/vboxvalidationkit/* "${MY_TARGET}/root/validationkit/" 189 log_command chmod -R u+rw,a+xr "${MY_TARGET}/root/validationkit/" 190 191 # systemd service config: 192 MY_UNIT_PATH="${MY_TARGET}/lib/systemd/system" 193 test -d "${MY_TARGET}/usr/lib/systemd/system" && MY_UNIT_PATH="${MY_TARGET}/usr/lib/systemd/system" 194 if [ -d "${MY_UNIT_PATH}" ]; then 195 log_command cp "${MY_TARGET}/linux/vboxtxs.service" "${MY_UNIT_PATH}/vboxtxs.service" 196 log_command chmod 644 "${MY_UNIT_PATH}/vboxtxs.service" 197 log_command_in_target systemctl -q enable vboxtxs 198 199 # Not systemd: Add support for upstart later... 200 else 201 echo "** error: No systemd unit dir found. Using upstart or something?" | tee -a "${MY_LOGFILE}" 202 fi 203 56 204 @@VBOX_COND_END@@ 57 205 58 echo "Final exit code: ${MY_EXITCODE}" >> "${MY_LOGFILE}" 206 207 # 208 # Run user command. 209 # 210 @@VBOX_COND_HAS_POST_INSTALL_COMMAND@@ 211 echo '** Running custom user command ...' | tee -a "${MY_LOGFILE}" 212 log_command @@VBOX_INSERT_POST_INSTALL_COMMAND@@ 213 @@VBOX_COND_END@@ 214 215 216 # 217 # Unmount the cdrom if we bound it and clean up the chroot if we set it up. 218 # 219 if [ -n "${MY_UNMOUNT_TARGET_CDROM}" ]; then 220 echo "** unbinding cdrom from jail..." | tee -a "${MY_LOGFILE}" 221 log_command umount "${MY_TARGET}/cdrom" 222 fi 223 224 if [ -n "${MY_RMDIR_TARGET_CDROM}" ]; then 225 log_command rmdir "${MY_TARGET}/cdrom" 226 fi 227 228 229 # 230 # Log footer. 231 # 232 echo "******************************************************************************" >> "${MY_LOGFILE}" 233 echo "** Date: `date -R`" >> "${MY_LOGFILE}" 234 echo "** Final exit code: ${MY_EXITCODE}" >> "${MY_LOGFILE}" 235 echo "******************************************************************************" >> "${MY_LOGFILE}" 236 59 237 exit ${MY_EXITCODE} 60 238
Note:
See TracChangeset
for help on using the changeset viewer.