Moving partial python rewrite to separate branch, let's do it in the jessie+1 cycle...
[debian-live-build.git] / scripts / build / binary_win32-loader
blobe93e31a60f886464e953acb2ff31e243970f84ab
1 #!/bin/sh
3 ## live-build(7) - System Build Scripts
4 ## Copyright (C) 2006-2014 Daniel Baumann <mail@daniel-baumann.ch>
5 ##
6 ## This program comes with ABSOLUTELY NO WARRANTY; for details see COPYING.
7 ## This is free software, and you are welcome to redistribute it
8 ## under certain conditions; see COPYING for details.
11 set -e
13 # Including common functions
14 [ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.sh
16 # Setting static variables
17 DESCRIPTION="$(Echo 'copy win32-loader into binary')"
18 HELP=""
19 USAGE="${PROGRAM} [--force]"
21 Arguments "${@}"
23 # Reading configuration files
24 Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source
25 Set_defaults
27 if [ "${LB_WIN32_LOADER}" != "true" ]
28 then
29 exit 0
32 Echo_message "Begin copying win32-loader..."
34 # Requiring stage file
35 Require_stagefile .build/config .build/bootstrap
37 # Checking stage file
38 Check_stagefile .build/binary_win32-loader
40 # Checking lock file
41 Check_lockfile .lock
43 # Creating lock file
44 Create_lockfile .lock
46 case "${LIVE_IMAGE_ARCHITECTURE}" in
47 amd64|i386)
48 if [ "${LB_BUILD_WITH_CHROOT}" = "true" ]
49 then
50 # Checking depends
51 Check_package chroot/usr/share/win32/win32-loader.exe win32-loader
53 # Restoring cache
54 Restore_cache cache/packages.binary
56 # Installing depends
57 Install_package
59 # Copying win32-loader
60 cp -r chroot/usr/share/win32/* binary
61 else
62 cp -r usr/share/win32/* binary
65 mv binary/win32-loader.exe binary/setup.exe
66 mv binary/win32-loader/g2ldr* binary
67 rmdir binary/win32-loader > /dev/null 2>&1 || true
69 cat >> binary/autorun.inf << EOF
70 [autorun]
71 open=setup.exe
72 EOF
74 if [ "${LB_DEBIAN_INSTALLER}" != "false" ]
75 then
77 cat > binary/win32-loader.ini << EOF
78 [installer]
79 kernel=linux
80 arch=${LIVE_IMAGE_ARCHITECTURE}
81 default_desktop=gnome
82 ${LIVE_IMAGE_ARCHITECTURE}/linux=install/vmlinuz
83 ${LIVE_IMAGE_ARCHITECTURE}/initrd=install/initrd.gz
84 EOF
86 if [ -e binary/install/gtk ]
87 then
89 cat >> binary/win32-loader.ini << EOF
90 ${LIVE_IMAGE_ARCHITECTURE}/gtk/linux=install/vmlinuz
91 ${LIVE_IMAGE_ARCHITECTURE}/gtk/initrd=install/gtk/initrd.gz
92 EOF
96 cat >> binary/win32-loader.ini << EOF
98 [grub]
99 g2ldr=g2ldr
100 g2ldr.mbr=g2ldr.mbr
105 # Saving cache
106 Save_cache cache/packages.binary
108 # Removing depends
109 Remove_package
113 Echo_warning "win32-loader inclusion is set to true but not compatible with your architecture, ignoring."
115 esac
117 # Creating stage file
118 Create_stagefile .build/binary_win32-loader