bfe0393f254c553d700db29e695daabcbae22001
[live-build.git] / scripts / build / binary_win32-loader
1 #!/bin/sh
2
3 ## live-build(7) - System Build Scripts
4 ## Copyright (C) 2006-2013 Daniel Baumann <daniel@debian.org>
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.
9
10
11 set -e
12
13 # Including common functions
14 [ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.sh
15
16 # Setting static variables
17 DESCRIPTION="$(Echo 'copy win32-loader into binary')"
18 HELP=""
19 USAGE="${PROGRAM} [--force]"
20
21 Arguments "${@}"
22
23 # Reading configuration files
24 Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source
25 Set_defaults
26
27 if [ "${LB_WIN32_LOADER}" != "true" ]
28 then
29         exit 0
30 fi
31
32 Echo_message "Begin copying win32-loader..."
33
34 # Requiring stage file
35 Require_stagefile .build/config .build/bootstrap
36
37 # Checking stage file
38 Check_stagefile .build/binary_win32-loader
39
40 # Checking lock file
41 Check_lockfile .lock
42
43 # Creating lock file
44 Create_lockfile .lock
45
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
52
53                         # Restoring cache
54                         Restore_cache cache/packages.binary
55
56                         # Installing depends
57                         Install_package
58
59                         # Copying win32-loader
60                         cp -r chroot/usr/share/win32/* binary
61                 else
62                         cp -r usr/share/win32/* binary
63                 fi
64
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
68
69 cat >> binary/autorun.inf << EOF
70 [autorun]
71 open=setup.exe
72 EOF
73
74                 if [ "${LB_DEBIAN_INSTALLER}" != "false" ]
75                 then
76
77 cat > binary/win32-loader.ini << EOF
78 [installer]
79 kernel=linux
80 arch=${LIVE_IMAGE_ARCHITECTURE}
81 default_desktop=gnome
82 i386/linux=install/vmlinuz
83 i386/initrd=install/initrd.gz
84 EOF
85
86                         if [ -e install/gtk ]
87                         then
88
89 cat >> binary/win32-loader.ini << EOF
90 i386/gtk/linux=install/vmlinuz
91 i386/gtk/initrd=install/gtk/initrd.gz
92 EOF
93
94                         fi
95
96 cat >> binary/win32-loader.ini << EOF
97
98 [grub]
99 g2ldr=g2ldr
100 g2ldr.mbr=g2ldr.mbr
101 EOF
102
103                 fi
104
105                 # Saving cache
106                 Save_cache cache/packages.binary
107
108                 # Removing depends
109                 Remove_package
110                 ;;
111
112         *)
113                 Echo_warning "win32-loader inclusion is set to true but not compatible with your architecture, ignoring."
114                 ;;
115 esac
116
117 # Creating stage file
118 Create_stagefile .build/binary_win32-loader