Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
open/make_livecd.sh
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
100 lines (88 sloc)
2.12 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #! /bin/bash | |
| #apt -y install live-build live-boot live-config apt-cacher-ng | |
| WORK_DIR=/var/temp | |
| DIR_NAME=deb-live | |
| OUTPUT_DIR=/mnt/c/temp/`date +%Y%m%d-%H%M` | |
| SRC_DIR=/mnt/c/temp/ | |
| #CPFILE=YES | |
| CPFILE=NO | |
| if [ ! -d $WORK_DIR ] ; then | |
| mkdir -p $WORK_DIR | |
| fi | |
| cd $WORK_DIR | |
| SRC_FILE_NAME=dev_sda.img.gz | |
| SRC_FILE=${SRC_DIR}${SRC_FILE_NAME} | |
| pgrep apt-cacher-ng >/dev/null 2>&1 | |
| if [ $? -ne 0 ] ; then | |
| apt-cacher-ng | |
| fi | |
| rm -rf ${DIR_NAME} | |
| mkdir ${DIR_NAME} | |
| cd ${DIR_NAME} | |
| lb config \ | |
| --distribution buster \ | |
| --apt-http-proxy "http://localhost:3142" \ | |
| --iso-publisher "HenaChoko <m.kasahara14@gmail.com>" \ | |
| --parent-archive-areas "main contrib non-free" \ | |
| --archive-areas "main contrib non-free" \ | |
| --memtest none \ | |
| --firmware-chroot false \ | |
| --debian-installer false \ | |
| --apt-indices false \ | |
| --parent-mirror-bootstrap http://ftp.jp.debian.org/debian/ \ | |
| --bootappend-live \ | |
| "boot=live config persistence noeject \ | |
| live-config.username=root \ | |
| live-config.utc=no \ | |
| live-config.timezone=Asia/Tokyo \ | |
| live-config.keyboard-model=jp106 \ | |
| live-config.keyboard-layouts=jp" | |
| cat << EOS >> config/package-lists/local.chroot.list | |
| procps | |
| gzip | |
| console-data | |
| pigz | |
| EOS | |
| cat << EOS > config/hooks/live/0099-custom.hook.binary | |
| #!/bin/bash | |
| set -e | |
| # remove install menu from isolinux | |
| sed -i -e '/include install.cfg/d' isolinux/menu.cfg | |
| # set boot timeout 3s | |
| sed -i -e 's/timeout 0/timeout 3/' isolinux/isolinux.cfg | |
| EOS | |
| cat << 'EOS' >> config/hooks/live/0099-custom.hook.chroot | |
| #!/bin/bash | |
| set -e | |
| cat << EOT >> /root/.profile | |
| loadkeys jp106 | |
| if [ `tty` = /dev/tty1 ] ; then | |
| ./auto_run.sh & | |
| fi | |
| EOT | |
| cat << EOT >> /root/auto_run.sh | |
| #! /bin/bash | |
| while [ true ] ; do echo ; date ; pkill -USR1 dd ; sleep 10 ; done & | |
| if [ -f /var/data/dev_sda.img.gz ] ; then | |
| pigz -dc /var/data/dev_sda.img.gz | dd of=/dev/sda | |
| else | |
| dd if=/dev/zero of=/dev/sda bs=100M count=1024 | |
| fi | |
| sync | |
| sync | |
| sync | |
| sleep 10 | |
| #shutdown -h now | |
| EOT | |
| chmod +x /root/auto_run.sh | |
| EOS | |
| if [ $CPFILE=YES -a -f ${SRC_FILE} ] ; then | |
| mkdir -p config/includes.chroot/var/data/ | |
| cp ${SRC_FILE} config/includes.chroot/var/data/ | |
| fi | |
| lb build | |
| if [ ! -d ${OUTPUT_DIR} ] ; then | |
| mkdir -p ${OUTPUT_DIR} | |
| fi | |
| mv -f *.iso ${OUTPUT_DIR} | |
| exit 0 |