Woobuntu woobuntu_build.sh Hacking

Source: Internet
Author: User

# Woobuntu Woobuntu_build.SHhacking# Description: # Sometimes because of some needs, we need to customize some systems, including Ubuntu system, so we naturally need to know how to unpack an Ubuntu image, how to synthesize an Ubuntu image. # Of course, this also helps to follow the customization of Linux complete system. ##                                    .-4- -Shenzhen Nanshan Ping Shan Village Zengjianfeng # # # Reference Document: #1How to make a boot image in ISO format under Linux # https://www.v2ex.com/t/252789#2. Easy way to make ISO files under Ubuntu # http://www.xuebuyuan.com/1292033.html#3. Mount ISO read/write# http://www.linuxquestions.org/questions/linux-software-2/mount-iso-read-write-329688/#4. woobuntu# https://Github.com/woolabs/woobuntu#!/bin/bash#author:woolabs Team #Maintainer: [Email Protected]chroot_args="- C"# Help Information Show_help () {Echo " __    __            _                 _         ";Echo "/ / /\ \ \___   ___ | |__  _   _ _ __ | |_ _   _ ";Echo "\ \/  \/ / _ \ / _ \| ' _ \| | | | ' _ \| __| | | |";Echo " \  /\  / (_) | (_) | |_) | |_| | | | | |_| |_| |";Echo "  \/  \/ \___/ \___/|_.__/ \__,_|_| |_|\__|\__,_|";Echo "                                                 ";Echo "Usage:"Echo "- f The Ubuntu base image you wanna use for Woobuntu build"Echo "- o The output woobuntu image"Echo "- x Xubuntu optimization for ZH_CN & pre-configuration"Echo "- G Gnome-ubuntu optimization for ZH_CN & pre-configuration"Echo "- u Ubuntu original optimization for ZH_CN & pre-configuration"Echo "-N pre-install NVIDIA driver (use with causion)"Echo "-v pre-install virtualbox-guest Additions (use with causion)"Echo ""Echo "Example:"Echo ""Echo "./woobuntu_build.sh-f Xubuntu-15.10-desktop-amd64.iso-o woobuntu-current-amd64.iso-x"the}# parameter is 0 when the help message is displayedif[ $# =0 ] ThenShow_help Exit0fi# Parse command-line arguments whileGetopts"H?F:O:XGUNV"Opt Do     Case "$opt" inchh|\?) Show_help Exit0        ;; f) Input_iso=$OPTARG;; O) Output_iso=$OPTARG;; x) Chroot_args="$chroot _args-x"        ;; g) Chroot_args="$chroot _args-g"        ;; u) Chroot_args="$chroot _args-u"        ;; N) Chroot_args="$chroot _args-n"        ;; V) Chroot_args="$chroot _args-v"        ;; Esac DoneEcho "You need following packages to Continue:squashfs-tools Dchroot"#Depends on Dchroot to create iso# relies on root permissions to generate an ISO filesudoApt-getInstallSquashfs-tools Dchroot Mkisofs-Y#create Temp Folder toMountOrigin iso# Create temp folder to mount source ISO filemkdir/tmp/livecd#mount Origin iso to temp folder to extract SQUASHFSfile# mount Source ISO file to/tmp/LiveCD Directorysudo Mount-O loop $input _iso/tmp/Livecd#create Temp folder to store ISO image files# Create temp directory to store ISO image filesmkdir-P livecd/Cd#don'T copy squashfs file As we'll repack this file later# --exclude: Specify files that do not need to be copied;/casper/the Filesystem.squashfs file uses the files that are synthesized later, so the copy rsync can be ignored here--exclude=/casper/filesystem.squashfs-a/tmp/livecd/livecd/Cd#create Temp Folder toMountSquashfsfile& copy everything Out formodification# Creates a temp folder to mount the Squashfs file, and copies all the contents to modifymkdirLIVECD/SQUASHFS livecd/custom#need to load before use# before using the SQUASHFS tool, you need to loadsudo modprobeSquashfs#mount the squashfile# mount the squash file systemsudo Mount-T Squashfs-o LOOP/TMP/LIVECD/CASPER/FILESYSTEM.SQUASHFS livecd/squashfs/#Copy everything out forModification (SQUASHFSfileitself is read-only) # copies all the files in the squash file system, mainly because SQUASHFS is a read-only file systemsudo CP-A LIVECD/SQUASHFS/* Livecd/custom#enable Network related configuration inside Chroot env# enable networking functionality because subsequent use of network updater sudo cp/etc/resolv.conf/etc/ Hosts livecd/custom/etc/#Copy Wooyun-firefox user-profile into chroot env# copy wooyun-firefox user-profile to chroot directory, For subsequent use sudo cp-r. Mozilla livecd/custom/root#drop The chroot install script inside# copy woobuntu_chroot_ build.sh file to chroot directory sudo cp woobuntu_chroot_build.sh livecd/custom/root#execute the install script inside Chroot env# Execute chroot related scripts sudo chroot livecd/custom/bin/bash-x/root/woobuntu_chroot_build.sh $chroot _args#everything should be Done except re-check the Mount Pointssudo umount-lf livecd/custom/procsudo umount-lf livecd/custom/sys#renew the Manifes Tchmod +w livecd/cd/casper/filesystem.manifest#chmod +w livecd/cd/preseed/xubuntu.seed#cat > livecd/cd/preseed/ Xubuntu.seed <<eof#d-i debian-installer/locale string zh_cn#d-i mirror/http/mirror Select CN.archive.ubuntu.com #d-I Clock-setup/utc boolean false#d-i time/zone string asia/shanghai#d-i cloCK-SETUP/NTP boolean True#tasksel tasksel/first multiselect xubuntu-desktop#d-i pkgsel/update-policy Select None#d-i Finish-install/reboot_in_progress note#eofsudo chroot livecd/custom dpkg-query-w--showformat= ' ${Package} ${Version} \ n ' > Livecd/cd/casper/filesystem.manifestsudo cp livecd/cd/casper/filesystem.manifest livecd/cd/casper/ Filesystem.manifest-desktop#repack the SQUASHFS file# repack squashfs file system sudo mksquashfs livecd/custom livecd/cd/casper/ Filesystem.squashfs#re-create the MD5 file# recalculate MD5 file sudo rm livecd/cd/md5sum.txtsudo bash-c ' CD LIVECD/CD && fin D. -type f-exec md5sum {} + ' > livecd/cd/md5sum.txt#repack ISO file# regenerate ISO file CD Livecd/cdsudo mkisofs-r-V "Woobuntu-li VE "-B isolinux/isolinux.bin-c isolinux/boot.cat-cache-inodes-j-l-no-emul-boot-boot-load-size 4-boot-info-table-o Output.iso. MV Output.iso. /.. /CD. /.. /MV output.iso $output _iso#umount and clean# uninstallation related content sudo Umount livecd/squashfs/sudo umount/tmp/livecd#sudo rm-fr livecd/ echo "BuiLD finished " 

Woobuntu woobuntu_build.sh Hacking

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.