Add --swap-file-path and --swap-file-size options (Closes: #629637).

This commit is contained in:
Colin Watson 2011-06-08 11:30:29 +01:00 committed by Daniel Baumann
parent f342cd85b8
commit abcc4ca9bf
4 changed files with 33 additions and 1 deletions

View File

@ -1044,6 +1044,9 @@ Set_defaults ()
;; ;;
esac esac
# Setting swap file
LB_SWAP_FILE_SIZE="${LB_SWAP_FILE_SIZE:-512}"
## config/source ## config/source
# Setting source option # Setting source option

View File

@ -460,6 +460,10 @@ defines if the security repositories specified in the security mirror options sh
defines if a corresponding source image to the binary image should be build. By default this is false because most people do not require this and would require to download quite a few source packages. However, once you start distributing your live image, you should make sure you build it with a source image alongside. defines if a corresponding source image to the binary image should be build. By default this is false because most people do not require this and would require to download quite a few source packages. However, once you start distributing your live image, you should make sure you build it with a source image alongside.
.IP "\-s|\fB\-\-source\-images\fR iso|net|tar|usb\-hdd" 4 .IP "\-s|\fB\-\-source\-images\fR iso|net|tar|usb\-hdd" 4
defines the image type for the source image. Default is tar. defines the image type for the source image. Default is tar.
.IP "\fB\-\-swap\-file\-path\fR \fIPATH\fR" 4
defines the path to a swap file to create in the binary image. Default is not to create a swap file.
.IP "\fB\-\-swap\-file\-size\fR \fIMB\fR" 4
defines what size in megabytes the swap file should be, if one is to be created. Default is 512MB.
.IP "\fB\-\-syslinux\-splash\fR \fIFILE\fR" 4 .IP "\fB\-\-syslinux\-splash\fR \fIFILE\fR" 4
defines the file of the syslinux splash graphic that should be used instead of the default one. defines the file of the syslinux splash graphic that should be used instead of the default one.
.IP "\fB\-\-syslinux\-timeout\fR \fISECONDS\fR" 4 .IP "\fB\-\-syslinux\-timeout\fR \fISECONDS\fR" 4

View File

@ -273,6 +273,11 @@ then
ln -s /proc/mounts chroot/etc/mtab ln -s /proc/mounts chroot/etc/mtab
fi fi
if [ "${LB_SWAP_FILE_PATH}" ]; then
dd if=/dev/zero of="chroot/${LB_SWAP_FILE_PATH}" bs=1024k count="${LB_SWAP_FILE_SIZE}"
mkswap "chroot/${LB_SWAP_FILE_PATH}"
fi
# Show popular warnings # Show popular warnings
if [ -e chroot/etc/init.d/resolvconf ] if [ -e chroot/etc/init.d/resolvconf ]
then then

View File

@ -131,6 +131,8 @@ USAGE="${PROGRAM} [--apt apt|aptitude]\n\
\t [--security true|false]\n\ \t [--security true|false]\n\
\t [--source true|false]\n\ \t [--source true|false]\n\
\t [-s|--source-images iso|net|tar|usb-hdd]\n\ \t [-s|--source-images iso|net|tar|usb-hdd]\n\
\t [--swap-file-path PATH]\n\
\t [--swap-file-size MB]\n\
\t [--syslinux-theme THEME_SUFFIX]\n\ \t [--syslinux-theme THEME_SUFFIX]\n\
\t [--tasksel apt|aptitude|tasksel]\n\ \t [--tasksel apt|aptitude|tasksel]\n\
\t [--tasks TASK|\"TASKS\"]\n\ \t [--tasks TASK|\"TASKS\"]\n\
@ -162,7 +164,7 @@ Local_arguments ()
grub-splash:,hostname:,isohybrid-options:,iso-application:,iso-preparer:,iso-publisher:, grub-splash:,hostname:,isohybrid-options:,iso-application:,iso-preparer:,iso-publisher:,
iso-volume:,jffs2-eraseblock:,memtest:,net-root-filesystem:,net-root-mountoptions:, iso-volume:,jffs2-eraseblock:,memtest:,net-root-filesystem:,net-root-mountoptions:,
net-root-path:,net-root-server:,net-cow-filesystem:,net-cow-mountoptions:,net-cow-path:, net-root-path:,net-root-server:,net-cow-filesystem:,net-cow-mountoptions:,net-cow-path:,
net-cow-server:,net-tarball:,syslinux-theme:, net-cow-server:,net-tarball:,swap-file-path:,swap-file-size:,syslinux-theme:,
username:,win32-loader:,source:,source-images:,breakpoints,conffile:,debug,force, username:,win32-loader:,source:,source-images:,breakpoints,conffile:,debug,force,
help,ignore-system-defaults,quiet,usage,verbose,version" help,ignore-system-defaults,quiet,usage,verbose,version"
# Remove spaces added by indentation # Remove spaces added by indentation
@ -730,6 +732,16 @@ Local_arguments ()
shift 2 shift 2
;; ;;
--swap-file-path)
LB_SWAP_FILE_PATH="${2}"
shift 2
;;
--swap-file-size)
LB_SWAP_FILE_SIZE="${2}"
shift 2
;;
--syslinux-theme) --syslinux-theme)
LB_SYSLINUX_THEME="${2}" LB_SYSLINUX_THEME="${2}"
shift 2 shift 2
@ -1336,6 +1348,14 @@ LB_NET_COW_SERVER="${LB_NET_COW_SERVER}"
# (Default: ${LB_NET_TARBALL}) # (Default: ${LB_NET_TARBALL})
LB_NET_TARBALL="${LB_NET_TARBALL}" LB_NET_TARBALL="${LB_NET_TARBALL}"
# \$LB_SWAP_FILE_PATH: set swap file path
# (Default: ${LB_SWAP_FILE_PATH})
LB_SWAP_FILE_PATH="${LB_SWAP_FILE_PATH}"
# \$LB_SWAP_FILE_SIZE: set swap file size
# (Default: ${LB_SWAP_FILE_SIZE})
LB_SWAP_FILE_SIZE="${LB_SWAP_FILE_SIZE}"
# \$LB_SYSLINUX_THEME: set syslinux theme package # \$LB_SYSLINUX_THEME: set syslinux theme package
# (Default: ${LB_SYSLINUX_THEME}) # (Default: ${LB_SYSLINUX_THEME})
LB_SYSLINUX_THEME="${LB_SYSLINUX_THEME}" LB_SYSLINUX_THEME="${LB_SYSLINUX_THEME}"