Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- excerpts extracted from
- refractasnapshot-base_10.2.10_all.deb (published Dec 2019)
- ____________________________________________________________
- BOOT METHODS ((( page3 of the F1 liveboot menu )))
- Methods list here must correspond to entries in your boot menu.
- live
- Start the live system -- this is the default CD-ROM method.
- nox
- Boot to runlevel 3 (command-line-only in Refracta and some others)
- nomodeset
- This is useful for some sytems with nvidia graphics cards.
- toram
- Copy whole read-only media to RAM before mounting root filesystem.
- noprobe
- Failsafe boot method. (noapic noapm nodma nomce nolapic nosmp vga=normal)
- memtest
- Start memtest to scan your RAM for errors.
- To use one of these boot methods, type it at the prompt, optionally
- followed by any boot parameters. For example:
- boot: live persistence acpi=off
- You may:
- - press F1 to return to the help index
- - type menu and press ENTER to go back to the boot screen
- - press ENTER to boot
- ____________________________________________________________
- content of
- snapshot_excludes.list.defaults
- # rsync excludes file for refractasnapshot and refractasnapshot-gui
- # version 9.3.4
- # Exclude some system files. These are required, and you probably shouldn't change them.
- - /dev/*
- - /cdrom/*
- - /media/*
- - /swapfile
- - /mnt/*
- - /sys/*
- - /proc/*
- - /tmp/*
- - /live
- - /persistence.conf
- - /boot/grub/grub.cfg
- - /boot/grub/menu.lst
- - /boot/grub/device.map
- - /boot/*.bak
- - /boot/*.old-dkms
- - /etc/udev/rules.d/70-persistent-cd.rules
- - /etc/udev/rules.d/70-persistent-net.rules
- - /etc/fstab
- - /etc/fstab.d/*
- - /etc/mtab
- - /etc/blkid.tab
- - /etc/blkid.tab.old
- - /etc/apt/sources.list~
- - /etc/crypttab
- - /etc/initramfs-tools/conf.d/resume # see remove-cryptroot and nocrypt.sh
- - /etc/initramfs-tools/conf.d/cryptroot # see remove-cryptroot and nocrypt.sh
- - /etc/popularity-contest.conf
- - /home/snapshot
- # Added for newer version of live-config/live-boot in wheezy
- # These are only relevant here if you create a snapshot while
- # you're running a live-CD or live-usb.
- - /lib/live/overlay
- - /lib/live/image
- - /lib/live/rootfs
- - /lib/live/mount
- - /run/*
- # Added for symlink /lib
- - /usr/lib/live/overlay
- - /usr/lib/live/image
- - /usr/lib/live/rootfs
- - /usr/lib/live/mount
- ## Entries below are optional. They are included either for privacy
- ## or to reduce the size of the snapshot. If you have any large
- ## files or directories, you should exclude them from being copied
- ## by adding them to this list.
- ##
- ## Entries beginning with /home/*/ will affect all users.
- # Uncomment this to exclude everything in /var/log/
- #- /var/log/*
- # As of version 9.2.0, current log files are truncated,
- # and archived log files are excluded.
- #
- # The next three lines exclude everything in /var/log
- # except /var/log/clamav/ (or anything else beginning with "c") and
- # /var/log/gdm (or anything beginning with "g").
- # If clamav log files are excluded, freshclam will give errors at boot.
- #- /var/log/[a-b,A-Z]*
- #- /var/log/[d-f]*
- #- /var/log/[h-z]*
- #- /var/log/*gz
- - /var/cache/apt/archives/*.deb
- - /var/cache/apt/pkgcache.bin
- - /var/cache/apt/srcpkgcache.bin
- - /var/cache/apt/apt-file/*
- - /var/cache/debconf/*~old
- - /var/lib/apt/lists/*
- - /var/lib/apt/*~
- - /var/lib/apt/cdroms.list
- - /var/lib/aptitude/*.old
- - /var/lib/dhcp/*
- - /var/lib/dpkg/*~old
- - /var/spool/mail/*
- - /var/mail/*
- - /var/backups/*.gz
- #- /var/backups/*.bak
- - /var/lib/dbus/machine-id
- - /var/lib/live/config/*
- - /usr/share/icons/*/icon-theme.cache
- - /root/.aptitude
- - /root/.bash_history
- - /root/.disk-manager.conf
- - /root/.fstab.log
- - /root/.lesshst
- - /root/*/.log
- - /root/.local/share/*
- - /root/.nano_history
- - /root/.synaptic
- - /root/.VirtualBox
- - /root/.ICEauthority
- - /root/.Xauthority
- - /root/.ssh
- - /home/*/.Trash*
- - /home/*/.local/share/Trash/*
- - /home/*/.mozilla/*/Cache/*
- - /home/*/.mozilla/*/urlclassifier3.sqlite
- - /home/*/.mozilla/*/places.sqlite
- - /home/*/.mozilla/*/cookies.sqlite
- - /home/*/.mozilla/*/signons.sqlite
- - /home/*/.mozilla/*/formhistory.sqlite
- - /home/*/.mozilla/*/downloads.sqlite
- - /home/*/.adobe
- - /home/*/.aptitude
- - /home/*/.bash_history
- - /home/*/.cache
- - /home/*/.dbus
- - /home/*/.gksu*
- - /home/*/.gvfs
- - /home/*/.lesshst
- - /home/*/.log
- - /home/*/.macromedia
- - /home/*/.nano_history
- - /home/*/.pulse*
- - /home/*/.recently-used
- - /home/*/.recently-used.xbel
- - /home/*/.local/share/recently-used.xbel
- - /home/*/.thumbnails/large/*
- - /home/*/.thumbnails/normal/*
- - /home/*/.thumbnails/fail/*
- - /home/*/.vbox*
- - /home/*/.VirtualBox
- - /home/*/VirtualBox\ VMs
- #- /home/*/.wine
- - /home/*/.xsession-errors*
- - /home/*/.ICEauthority
- - /home/*/.Xauthority
- # You might want to comment these out if you're making a snapshot for
- # your own personal use, not to be shared with others.
- - /home/*/.gnupg
- - /home/*/.ssh
- - /home/*/.xchat2
- - /home/*/.config/hexchat
- # Exclude ssh_host_keys. New ones will be generated upon live boot.
- # This fixes a security hole in all versions before 9.0.9-3.
- # If you really want to clone your existing ssh host keys
- # in your snapshot, comment out these two lines.
- - /etc/ssh/ssh_host_*_key*
- - /etc/ssh/ssh_host_key*
- # Examples of things to exclude in order to keep the image small:
- #- /home/fred/Downloads/*
- #- /home/*/Music/*
- #- /home/user/Pictures/*
- #- /home/*/Videos/*
- # To exclude all hidden files and directories in your home, uncomment
- # the next line. You will lose custom desktop configs if you do.
- #- /home/*/.[a-z,A-Z,0-9]*
- ____________________________________________
- content of installed file /usr/bin/refractasnapshot
- #!/usr/bin/env bash
- version="refractasnapshot-10.2.10 (20191218)"
- TEXTDOMAIN=refractasnapshot-base
- TEXTDOMAINDIR=/usr/share/locale/
- # Copyright: [email protected] 2011-2019
- # based on refractasnapshot-8.0.4 by Dean Linkous with ideas
- # borrowed from dzsnapshot-gui.sh by David Hare, which was based on an
- # earlier version of this script.
- # UEFI code adapted from similar scripts by Colin Watson and Patrick J. Volkerding
- #
- # License: GPL-3
- # This is free software with NO WARRANTY. Use at your own risk!
- #
- # DESCRIPTION
- # This script makes a copy of your system with rsync and then creates
- # an iso file to be used as a live-cd. There are options in the config
- # file to change the location of the copy and the location of the final
- # iso file, in case there's not enough room on the system drive. Read
- # the config file for more options. (/etc/refractasnapshot.conf)
- #
- #
- #
- # If you want to change any defaults, change them in the configfile.
- # Default is /etc/refractasnapshot.conf
- # If you want to use a different config file for testing,
- # either change this variable here or use the -c, --config option on
- # the command-line. (Command-line option will supercede this setting.)
- # Normally, users should not edit anything in this script.
- #
- configfile="/etc/refractasnapshot.conf"
- show_help () {
- printf "$help_text"
- exit 0
- }
- help_text=$"
- Usage: $0 [option]
- Run with no options to create .iso file for a live, bootable CD
- or DVD copy of the running system.
- valid options:
- -h, --help show this help text
- -v, --version display the version information
- -d. --debug debug mode
- -c, --config specify a different config file
- (file name must be next argument)
- example:
- refractasnapshot -n -c myconfigs
- *** See $configfile for information about settings.
- "
- while [[ $1 == -* ]]; do
- case "$1" in
- -h|--help)
- show_help ;;
- -v|--version)
- printf "\n$version\n\n"
- exit 0 ;;
- -c|--config)
- shift
- configfile="$1"
- printf "\n config file is $configfile\n\n"
- shift
- ;;
- -d|--debug)
- DEBUG="yes"
- shift ;;
- *)
- printf "\t invalid option: $1 \n\n"
- printf "\t Try: $0 -h for full help. \n\n"
- exit 1 ;;
- esac
- done
- # Check that user is root
- [[ $(id -u) -eq 0 ]] || { echo -e "\n\t You need to be root!\n" ; exit 1 ; }
- [[ -e "$configfile" ]] || { echo "Configuration file, $configfile is missing." ; exit 1 ; }
- # Fix root's path (for Buster/Beowulf and later)
- PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
- source "$configfile"
- # Record errors in a logfile.
- exec 2>"$error_log"
- if [[ $DEBUG = "yes" ]] ; then
- set -x
- fi
- echo "configfile is $configfile"
- echo "make_efi is $make_efi"
- # Check for grub-efi
- check_grub () {
- if [[ $make_efi = "yes" ]] ; then
- if ! (dpkg -l | grep "^ii" | grep "grub-efi-amd64" |grep -v "bin"); then
- echo $"grub-efi-amd64 is not installed"
- grub_message=$"Warning: grub-efi-amd64 is not installed. The snapshot may not be compatible with UEFI.
- To disable this warning, set make_efi=no in $configfile or set force_efi=yes for special use.
- "
- if [[ $force_efi = "yes" ]] ; then
- make_efi="yes"
- else
- make_efi="no"
- fi
- echo "force_efi is $force_efi"
- echo "make_efi is $make_efi"
- fi
- if [[ ! -e /var/lib/dpkg/info/dosfstools.list ]] ; then
- echo $"dosfstools is not installed"
- dosfstools_message=$"Warning: dosfstools is not installed. Your snapshot will not boot in uefi mode."
- force_efi="no"
- make_efi="no"
- echo "force_efi is $force_efi"
- echo "make_efi is $make_efi"
- fi
- fi
- }
- show_snapshot_help () {
- zless "$snapshot_help"
- choose_task
- }
- find_text_editor () {
- # Default text editor is nano. Make sure it exists if user intends to ### This needs attention!!! <<<<<<<<<
- # edit files before squashing the filesystem.
- #if [[ $edit_boot_menu = "yes" ]] ; then
- [[ -e $text_editor ]] || { echo -e $"\n Error! The text editor is set to ${text_editor},
- but it is not installed. Edit $configfile
- and set the text_editor variable to the editor of your choice.
- (examples: /usr/bin/vim, /usr/bin/joe)\n" ; exit 1 ; }
- #fi
- }
- unpatch_init () {
- # Check for previous patch
- if $(grep -q nuke "$target_file") ; then
- echo $"
- It looks like $target_file was previously patched by an
- earlier version of refractasnapshot. This patch is no longer needed.
- You can comment out the added lines as shown below (or remove the
- commented lines) and then run 'update-initramfs -u'.
- If you don't want to do that, dont worry;
- it won't hurt anything if you leave it the way it is.
- Do not change or remove the lines that begin with \"mount\"
- mount -n -o move /sys ${rootmnt}/sys
- #nuke /sys
- #ln -s ${rootmnt}/sys /sys
- mount -n -o move /proc ${rootmnt}/proc
- #nuke /proc
- #ln -s ${rootmnt}/proc /proc
- "
- while true ; do
- echo $"Open $target_file in an editor? (y/N)"
- read ans
- case $ans in
- [Yy]*) "$text_editor" "$target_file"
- update-initramfs -u
- break ;;
- *) break ;;
- esac
- done
- echo -e $"\n Wait for the disk report to complete...\n\n"
- fi
- }
- check_copies () {
- # Function to check for old snapshots and filesystem copy and their total size
- if [[ -d $snapshot_dir ]]; then
- if ls "$snapshot_dir"/*.iso > /dev/null ; then
- snapshot_count=$(ls "$snapshot_dir"/*.iso | wc -l)
- else
- snapshot_count="0"
- fi
- snapshot_size=$(du -sh "$snapshot_dir" | awk '{print $1}')
- if [[ -z $snapshot_size ]]; then
- snapshot_size="0 bytes"
- fi
- else
- snapshot_count="0"
- snapshot_size="0 bytes"
- fi
- # Check for saved copy of the system
- if [[ -d "$work_dir"/myfs ]]; then
- saved_size=$(du -sh "$work_dir"/myfs | awk '{ print $1 }')
- saved_copy=$(echo $"* You have a saved copy of the system using $saved_size of space
- located at $work_dir/myfs.")
- fi
- # Create a message to say whether the filesystem copy will be saved or not.
- if [[ $save_work = "yes" ]]; then
- save_message=$(echo $"* The temporary copy of the filesystem will be saved
- at $work_dir/myfs.")
- else
- save_message=$(echo $"* The temporary copy of the filesystem will be created
- at $work_dir/myfs and removed when this program finishes.")
- fi
- }
- check_directories () {
- # Create snapshot_dir and work_dir if necessary
- # Don't use /media/* for $snapshot_dir or $work_dir unless it is a mounted filesystem
- snapdir_is_remote=$(echo ${snapshot_dir} | awk -F / '{ print "/" $2 "/" $3 }' | grep /media/)
- workdir_is_remote=$(echo ${work_dir} | awk -F / '{ print "/" $2 "/" $3 }' | grep /media/)
- if [ -n "$snapdir_is_remote" ] && cat /proc/mounts | grep -q ${snapdir_is_remote}; then
- echo "$snapshot_dir is mounted"
- elif [ -n "$snapdir_is_remote" ] ; then
- echo $" Error.. The selected snapshot directory cannot be accessed. Do you need to mount it?"
- exit 1
- fi
- if [ -n "$workdir_is_remote" ] && cat /proc/mounts | grep -q ${workdir_is_remote}; then
- echo "$work_dir is mounted"
- elif [ -n "$workdir_is_remote" ] ; then
- echo $" Error.. The selected work directory cannot be accessed. Do you need to mount it?"
- exit 1
- fi
- # Check that snapshot_dir exists
- if ! [[ -d $snapshot_dir ]]; then
- mkdir -p "$snapshot_dir"
- chmod 777 "$snapshot_dir"
- fi
- # Check that work directories exist or create them
- if [[ $save_work = "no" ]]; then
- if [[ -d $work_dir ]]; then
- rm -rf "$work_dir"
- fi
- mkdir -p "$work_dir"/iso
- mkdir -p "$work_dir"/myfs
- elif [[ $save_work = "yes" ]]; then
- if ! [[ -d $work_dir ]]; then
- mkdir -p "$work_dir"/iso
- mkdir -p "$work_dir"/myfs
- fi
- fi
- }
- check_space () {
- # Check disk space on mounted /, /home, /media, /mnt, /tmp
- disk_space=$(df -h -x tmpfs -x devtmpfs -x iso9660 | awk '{ print " " $2 "\t" $3 "\t" $4 "\t" $5 " \t" $6 "\t\t\t" $1 }')
- }
- # Check initrd for cryptroot, resume, cryptsetup.
- check_initrd () {
- if lsinitramfs "$initrd_image" | grep -q conf.d/cryptroot ; then
- remove_cryptroot="yes"
- cryptroot_message="The snapshot initrd will be modified to allow booting the unencrypted snapshot."
- elif lsinitramfs "$initrd_image" | grep -q cryptroot/crypttab ; then
- remove_cryptroot="yes"
- cryptroot_message="The snapshot initrd will be modified to allow booting the unencrypted snapshot."
- fi
- if lsinitramfs "$initrd_image" | egrep -q 'conf.d/resume|conf.d/zz-resume-auto' ; then
- remove_resume="yes"
- swap_message="The snapshot initrd will be modified to allow booting without the host's swap partition."
- fi
- if [ "$initrd_crypt" = yes ] ; then
- if lsinitramfs "$initrd_image" | grep -q cryptsetup ; then
- crypt_message="The host initrd already allows live-usb encrypted persistence. No change is needed."
- initrd_crypt="no"
- else
- crypt_message="The host initrd will be modified to allow live-usb encrypted persistence.
- A backup copy will be made at ${initrd_image}_pre-snapshot. (Does not apply to any re-run tasks.)"
- fi
- fi
- }
- extract_initrd () {
- mkdir /tmp/extracted
- pushd /tmp/extracted
- COMPRESSION=$(file -L "$initrd_image" | egrep -o 'gzip compressed|XZ compressed|cpio archive')
- if [ "$COMPRESSION" = "gzip compressed" ]; then
- echo "Archive is gzip compressed..."
- zcat "$initrd_image" | cpio -i
- elif [ "$COMPRESSION" = "XZ compressed" ]; then
- echo "Archive is XZ compressed..."
- xzcat "$initrd_image" | cpio -d -i -m
- elif [ "$COMPRESSION" = "cpio archive" ]; then
- echo "Archive is cpio archive..."
- (cpio -i ; zcat | cpio -i) < "$initrd_image"
- exit_code="$?"
- if [ "$exit_code" -ne 0 ] ; then
- (cpio -i ; xzcat | cpio -i) < "$initrd_image"
- exit_code="$?"
- if [ "$exit_code" -ne 0 ] ; then
- echo "Decompression error" && exit 1
- else
- COMPRESSION="XZ compressed"
- fi
- else
- COMPRESSION="gzip compressed"
- fi
- echo "COMPRESSION is $COMPRESSION"
- else
- echo "Decompession error..." && exit 1
- fi
- popd
- echo "Initrd is extracted"
- }
- edit_initrd () {
- pushd /tmp/extracted
- if [ -f conf/conf.d/cryptroot ] ; then
- echo "Removing cryptroot"
- rm -f conf/conf.d/cryptroot
- elif [ -f cryptroot/crypttab ] ; then
- echo "Removing crypttab"
- rm -f cryptroot/crypttab
- fi
- if [ -f conf/conf.d/resume ] ; then
- echo "Removing resume"
- rm -f conf/conf.d/resume
- rm -f "$work_dir"/myfs/etc/initramfs-tools/conf.d/resume
- elif [ -f conf/conf.d/zz-resume-auto ] ; then
- echo "Removing resume"
- rm -f conf/conf.d/zz-resume-auto
- rm -f "$work_dir"/myfs/etc/initramfs-tools/conf.d/resume
- fi
- popd
- }
- rebuild_initrd () {
- pushd /tmp/extracted
- if [ "$COMPRESSION" = "gzip compressed" ] ; then
- find . -print0 | cpio -0 -H newc -o | gzip -c > ${work_dir}/iso/live/${initrd_image##*/}
- elif [ "$COMPRESSION" = "XZ compressed" ] ; then
- find . | cpio -o -H newc | xz --check=crc32 --x86 --lzma2=dict=512KiB > ${work_dir}/iso/live/${initrd_image##*/}
- else
- echo "Compression error..."
- exit 1
- fi
- popd
- rm -rf /tmp/extracted
- }
- clean_initrd () {
- extract_initrd
- edit_initrd
- rebuild_initrd
- }
- report_space () {
- # Show current settings and disk space
- if [[ -f "/usr/bin/less" ]] ; then
- pager="/usr/bin/less"
- else
- pager="/bin/more"
- fi
- echo $"
- You will need plenty of free space. It is recommended that free space
- (Avail) in the partition that holds the work directory (probably \"/\")
- should be two times the total installed system size (Used). You can
- deduct the space taken up by previous snapshots and any saved copies of
- the system from the Used amount.
- ${grub_message}
- ${dosfstools_message}
- * You have $snapshot_count snapshots taking up $snapshot_size of disk space.
- $saved_copy
- $save_message
- * The snapshot directory is currently set to $snapshot_dir
- $tmp_warning
- You can change these and other settings by editing
- $configfile.
- Turn off NUM LOCK for some laptops.
- ${crypt_message}
- ${cryptroot_message}
- ${swap_message}
- Current disk usage:
- (For complete listing, exit and run 'df -h')
- $disk_space
- To proceed, press q.
- To exit, press q and then press ctrl-c
- " | "$pager"
- }
- choose_task () {
- if [[ $make_efi = "yes" ]] ; then
- uefi_message=$"uefi enabled"
- else
- uefi_message=$"uefi disabled"
- fi
- while true; do
- echo $"
- Choose a task.
- 1. Create a snapshot ($uefi_message)
- 2. Re-squash and make iso (no-copy)
- 3. Re-make efi files and iso (no-copy, no-squash)
- 4. Re-run xorriso only. (make iso, no-copy, no-squash)
- 5. Help
- 6. Exit
- "
- read ans
- case $ans in
- 1) # Create snapshot
- echo $"This may take a moment while the program checks for free space. "
- check_copies
- check_directories
- check_space
- check_initrd
- report_space
- set_distro_name
- housekeeping
- if [[ $initrd_crypt = "yes" ]] ; then
- prepare_initrd_crypt
- fi
- # The real work starts here 01
- cd "$work_dir"
- copy_isolinux
- copy_kernel
- copy_filesystem
- if [ "$remove_cryptroot" = yes ] || [ "$remove_resume" = yes ] ; then
- clean_initrd
- fi
- edit_system
- get_filename
- if [[ $make_efi = "yes" ]] ; then
- mkefi
- fi
- add_extras
- set_boot_options
- if [[ $edit_boot_menu = "yes" ]] ; then
- edit_boot_menus
- fi
- squash_filesystem
- make_iso_fs
- cleanup
- final_message
- exit 0 ;;
- 2) # Re-squash
- if [[ $make_efi = "yes" ]] ; then
- uefi_opt="-eltorito-alt-boot -e boot/grub/efiboot.img -isohybrid-gpt-basdat -no-emul-boot"
- fi
- # The real work starts here 02
- cd "$work_dir"
- get_filename
- squash_filesystem
- make_iso_fs
- final_message
- exit 0 ;;
- 3) # Re-make efi
- # The real work starts here 03
- [[ $make_efi = "yes" ]] || exit 1
- cd "$work_dir"
- get_filename
- set_distro_name
- mkefi
- set_boot_options
- find_editor
- edit_boot_menus
- make_iso_fs
- final_message
- exit 0 ;;
- 4) # Re-make iso
- # The real work starts here 04
- if [[ $make_efi = "yes" ]] ; then
- uefi_opt="-eltorito-alt-boot -e boot/grub/efiboot.img -isohybrid-gpt-basdat -no-emul-boot"
- fi
- cd "$work_dir"
- get_filename
- make_iso_fs
- final_message
- exit 0 ;;
- 5) show_snapshot_help ;;
- [6qQxX]) exit 0 ;;
- esac
- done
- }
- set_distro_name () {
- if [[ $iso_dir = "/usr/lib/refractasnapshot/iso" ]] && [[ $boot_menu = "live.cfg" ]] ; then
- DISTRO=$(lsb_release -i -s 2>/dev/null)
- if $(grep -q Refracta /etc/issue) ; then
- DISTRO="Refracta"
- fi
- while true ; do
- echo $"
- This is the distribution name that will appear in the boot menu for the
- live image. You can change it to something else, or you can blank this,
- and the the menu entries will just say \"GNU/Linux <kernel-version>\"
- "
- # # Redirect stderr from the error log to the screen,
- # # so we can see the prompts from read.
- exec 2>&1
- read -p $" Enter, erase or change distro name: " -i "$DISTRO" -e answer
- # # Resume logging errors.
- exec 2>>"$error_log"
- break
- done
- if [[ -z "$answer" ]] ; then
- DISTRO="GNU/Linux `uname -r`"
- else
- DISTRO="$answer"
- fi
- fi
- }
- housekeeping () {
- # Test for systemd, util-linux version and patch intramfs-tools/init.
- if [[ $patch_init_nosystemd = "yes" ]] ; then
- utillinux_version=$(dpkg -l util-linux | awk '/util-linux/ { print $3 }' | cut -d. -f2)
- target_file="/usr/share/initramfs-tools/init"
- # patch_file="/usr/lib/refractasnapshot/init_for_util-lin.patch"
- if [[ ! -h /sbin/init ]] ; then
- if [[ $utillinux_version -ge 25 ]] ; then
- unpatch_init
- fi
- fi
- fi
- # Use the login name set in the config file. If not set, use the primary
- # user's name. If the name is not "user" then add boot option. ALso use
- # the same username for cleaning geany history.
- if [[ -n "$username" ]] ; then
- username_opt="username=$username"
- else
- username=$(awk -F":" '/1000:1000/ { print $1 }' /etc/passwd)
- if [[ $username != user ]] ; then
- username_opt="username=$username"
- fi
- fi
- # Check that kernel and initrd exist
- [[ -e "$kernel_image" ]] || kernel_message=" Warning: Kernel image is missing. "
- [[ -e "$initrd_image" ]] || initrd_message=" Warning: initrd image is missing. "
- if [[ -n "$kernel_message" ]] || [[ -n "$initrd_message" ]] ; then
- echo $"
- $kernel_message
- $initrd_message
- Make sure the kernel_image and/or initrd_image
- set in the config file are correct, and check
- that the boot menu is also correct.
- "
- exit 1
- fi
- # update the mlocate database
- if [[ $update_mlocate = "yes" ]]; then
- echo -e $"\nRunning updatedb...\n"
- updatedb
- fi
- }
- prepare_initrd_crypt () {
- # Prepare initrd to use encryption
- # This is only going to work if the latest kernel version is running.
- # (i.e. the one linked from /initrd.img)
- # Add '-k all' or specify the initrd to use???
- cp "$initrd_image" "${initrd_image}_pre-snapshot"
- sed -i 's/.*CRYPTSETUP=.*/CRYPTSETUP=y/' /etc/cryptsetup-initramfs/conf-hook
- if [[ -f /usr/sbin/update-initramfs.orig.initramfs-tools ]] ; then
- /usr/sbin/update-initramfs.orig.initramfs-tools -u
- else
- /usr/sbin/update-initramfs -u
- fi
- }
- copy_isolinux () {
- if [[ -f /usr/lib/ISOLINUX/isolinux.bin ]] ; then
- isolinuxbin="/usr/lib/ISOLINUX/isolinux.bin"
- elif [[ -f /usr/lib/syslinux/isolinux.bin ]] ; then
- isolinuxbin="/usr/lib/syslinux/isolinux.bin"
- else
- echo $"You need to install the isolinux package."
- exit 1
- fi
- # @@@@ Warning: This will replace these files in custom iso_dir @@@@@
- if [[ -f /usr/lib/syslinux/modules/bios/vesamenu.c32 ]] ; then
- vesamenu="/usr/lib/syslinux/modules/bios/vesamenu.c32"
- rsync -a /usr/lib/syslinux/modules/bios/chain.c32 "$iso_dir"/isolinux/
- rsync -a /usr/lib/syslinux/modules/bios/ldlinux.c32 "$iso_dir"/isolinux/
- rsync -a /usr/lib/syslinux/modules/bios/libcom32.c32 "$iso_dir"/isolinux/
- rsync -a /usr/lib/syslinux/modules/bios/libutil.c32 "$iso_dir"/isolinux/
- else
- vesamenu="/usr/lib/syslinux/vesamenu.c32"
- fi
- rsync -a "$isolinuxbin" "$iso_dir"/isolinux/
- rsync -a "$vesamenu" "$iso_dir"/isolinux/
- # Add Refracta-specific boot help files
- if [[ $refracta_boot_help = "yes" ]] ; then
- cp -a /usr/lib/refractasnapshot/boot_help/* "$iso_dir"/isolinux/
- fi
- }
- # Let iso/, vmlinuz and initrd.img get copied, even if work_dir was saved,
- # in case they have changed.
- copy_kernel () {
- rsync -a "$iso_dir"/ "$work_dir"/iso/
- cp "$kernel_image" "$work_dir"/iso/live/
- cp "$initrd_image" "$work_dir"/iso/live/
- }
- copy_filesystem () {
- if [[ $limit_cpu = "yes" ]] ; then
- [[ $(type -p cpulimit) ]] || \
- while true ; do
- echo -n $"
- The cpulimit program is not installed. Your CPU will not be limited.
- Would you like to continue anyway? (y/N)
- "
- read ans
- case $ans in
- [Yy]*) break ;;
- *) exit 0 ;;
- esac
- done
- cpulimit -e rsync -l "$limit" &
- pid="$!"
- fi
- rsync -av / myfs/ ${rsync_option1} ${rsync_option2} ${rsync_option3} \
- --exclude="$work_dir" --exclude="$snapshot_dir" --exclude="$efi_work" --exclude-from="$snapshot_excludes"
- if [[ -n "$pid" ]] ; then
- kill "$pid"
- fi
- }
- edit_system () {
- # Truncate logs, remove archived logs.
- find myfs/var/log -name "*gz" -print0 | xargs -0r rm -f
- find myfs/var/log/ -type f -exec truncate -s 0 {} \;
- # Allow all fixed drives to be mounted with pmount
- if [[ $pmount_fixed = "yes" ]] ; then
- if [[ -f "$work_dir"/myfs/etc/pmount.allow ]]; then
- sed -i 's:#/dev/sd\[a-z\]:/dev/sd\[a-z\]:' "$work_dir"/myfs/etc/pmount.allow
- fi
- fi
- # Clear list of recently used files in geany for primary user.
- if [[ $clear_geany = "yes" ]] ; then
- sed -i 's/recent_files=.*;/recent_files=/' "$work_dir"/myfs/home/"$username"/.config/geany/geany.conf
- fi
- # Enable or disable password login through ssh for users (not root)
- # Remove obsolete live-config file
- if [[ -e "$work_dir"/myfs/lib/live/config/1161-openssh-server ]] ; then
- rm -f "$work_dir"/myfs/lib/live/config/1161-openssh-server
- fi
- sed -i 's/PermitRootLogin yes/PermitRootLogin prohibit-password/' "$work_dir"/myfs/etc/ssh/sshd_config
- if [[ $ssh_pass = "yes" ]] ; then
- sed -i 's|.*PasswordAuthentication.*no|PasswordAuthentication yes|' "$work_dir"/myfs/etc/ssh/sshd_config
- # sed -i 's|#.*PasswordAuthentication.*yes|PasswordAuthentication yes|' "$work_dir"/myfs/etc/ssh/sshd_config
- elif [[ $ssh_pass = "no" ]] ; then
- sed -i 's|.*PasswordAuthentication.*yes|PasswordAuthentication no|' "$work_dir"/myfs/etc/ssh/sshd_config
- fi
- # /etc/fstab should exist, even if it's empty,
- # to prevent error messages at boot
- touch "$work_dir"/myfs/etc/fstab
- # Blank out systemd machine id. If it does not exist, systemd-journald
- # will fail, but if it exists and is empty, systemd will automatically
- # set up a new unique ID.
- if [ -e "$work_dir"/myfs/etc/machine-id ]
- then
- rm -f "$work_dir"/myfs/etc/machine-id
- : > "$work_dir"/myfs/etc/machine-id
- fi
- # add some basic files to /dev
- mknod -m 622 "$work_dir"/myfs/dev/console c 5 1
- mknod -m 666 "$work_dir"/myfs/dev/null c 1 3
- mknod -m 666 "$work_dir"/myfs/dev/zero c 1 5
- mknod -m 666 "$work_dir"/myfs/dev/ptmx c 5 2
- mknod -m 666 "$work_dir"/myfs/dev/tty c 5 0
- mknod -m 444 "$work_dir"/myfs/dev/random c 1 8
- mknod -m 444 "$work_dir"/myfs/dev/urandom c 1 9
- chown -v root:tty "$work_dir"/myfs/dev/{console,ptmx,tty}
- ln -sv /proc/self/fd "$work_dir"/myfs/dev/fd
- ln -sv /proc/self/fd/0 "$work_dir"/myfs/dev/stdin
- ln -sv /proc/self/fd/1 "$work_dir"/myfs/dev/stdout
- ln -sv /proc/self/fd/2 "$work_dir"/myfs/dev/stderr
- ln -sv /proc/kcore "$work_dir"/myfs/dev/core
- mkdir -v "$work_dir"/myfs/dev/shm
- mkdir -v "$work_dir"/myfs/dev/pts
- chmod 1777 "$work_dir"/myfs/dev/shm
- # Clear configs from /etc/network/interfaces, wicd and NetworkManager
- # and netman, so they aren't stealthily included in the snapshot.
- if [[ -z $netconfig_opt ]] ; then
- echo "# The loopback network interface
- auto lo
- iface lo inet loopback
- " > "$work_dir"/myfs/etc/network/interfaces
- rm -f "$work_dir"/myfs/var/lib/wicd/configurations/*
- rm -f "$work_dir"/myfs/etc/wicd/wireless-settings.conf
- rm -f "$work_dir"/myfs/etc/NetworkManager/system-connections/*
- rm -f "$work_dir"/myfs/etc/network/wifi/*
- fi
- }
- get_filename () {
- # Need to define $filename here (moved up from genisoimage)
- # and use it as directory name to identify the build on the cdrom.
- # and put package list inside that directory
- if [[ $stamp = "datetime" ]]; then
- # use this variable so iso and sha256 have same time stamp
- filename="$snapshot_basename"-$(date +%Y%m%d_%H%M).iso
- else
- n=1
- while [[ -f "$snapshot_dir"/snapshot$n.iso ]]; do
- ((n++))
- done
- filename="$snapshot_basename"$n.iso
- fi
- }
- # create /boot and /efi for uefi.
- mkefi () {
- uefi_opt="-eltorito-alt-boot -e boot/grub/efiboot.img -isohybrid-gpt-basdat -no-emul-boot"
- #################################
- tempdir="$(mktemp -d /tmp/work_temp.XXXX)"
- # for initial grub.cfg
- mkdir -p "$tempdir"/boot/grub
- cat >"$tempdir"/boot/grub/grub.cfg <<EOF
- search --file --set=root /isolinux/isolinux.cfg
- set prefix=(\$root)/boot/grub
- source \$prefix/x86_64-efi/grub.cfg
- EOF
- #################################
- if ! [ -d "$efi_work" ] ; then
- mkdir "$efi_work"
- fi
- pushd "$efi_work"
- # start with empty directories.
- if [ -d "boot" ] ; then
- rm -rf boot
- fi
- if [ -d "efi" ] ; then
- rm -rf efi
- fi
- mkdir -p boot/grub/x86_64-efi
- mkdir -p efi/boot
- # copy splash
- cp "$iso_dir"/isolinux/splash.png boot/grub/splash.png
- # second grub.cfg file
- for i in $(ls /usr/lib/grub/x86_64-efi|grep part_|grep \.mod|sed 's/.mod//'); do echo "insmod $i" >> boot/grub/x86_64-efi/grub.cfg; done
- # Additional modules so we don't boot in blind mode. I don't know which ones are really needed.
- for i in efi_gop efi_uga ieee1275_fb vbe vga video_bochs video_cirrus jpeg png gfxterm ; do echo "insmod $i" >> boot/grub/x86_64-efi/grub.cfg ; done
- echo "source /boot/grub/grub.cfg" >> boot/grub/x86_64-efi/grub.cfg
- pushd "$tempdir"
- # make a tarred "memdisk" to embed in the grub image
- tar -cvf memdisk boot
- # make the grub image
- grub-mkimage -O "x86_64-efi" -m "memdisk" -o "bootx64.efi" -p '(memdisk)/boot/grub' search iso9660 configfile normal memdisk tar cat part_msdos part_gpt fat ext2 ntfs ntfscomp hfsplus chain boot linux
- popd
- # copy the grub image to efi/boot (to go later in the device's root)
- cp "$tempdir"/bootx64.efi efi/boot
- #######################
- ## Do the boot image "boot/grub/efiboot.img"
- dd if=/dev/zero of=boot/grub/efiboot.img bs=1K count=1440
- /sbin/mkdosfs -F 12 boot/grub/efiboot.img
- mkdir img-mnt
- mount -o loop boot/grub/efiboot.img img-mnt
- mkdir -p img-mnt/efi/boot
- cp "$tempdir"/bootx64.efi img-mnt/efi/boot/
- #######################
- # copy modules and font
- cp /usr/lib/grub/x86_64-efi/* boot/grub/x86_64-efi/
- # if this doesn't work try another font from the same place (grub's default, unicode.pf2, is much larger)
- # Either of these will work, and they look the same to me. Unicode seems to work with qemu. -fsr
- # cp /usr/share/grub/ascii.pf2 boot/grub/font.pf2
- cp /usr/share/grub/unicode.pf2 boot/grub/font.pf2
- # doesn't need to be root-owned
- chown -R 1000:1000 $(pwd) 2>/dev/null
- # Cleanup efi temps
- umount img-mnt
- rmdir img-mnt
- rm -rf "$tempdir"
- popd
- # Copy efi files to iso
- rsync -avx "$efi_work"/boot "$work_dir"/iso/
- rsync -avx "$efi_work"/efi "$work_dir"/iso/
- # Do the main grub.cfg (which gets loaded last):
- cp "$grub_template" "$work_dir"/iso/boot/grub/grub.cfg
- }
- add_extras () {
- # Prepend the dir name with a constant,
- # so you can find and delete the old ones
- # that might have different snapshot basenames.
- dir_prefix="pkglist"
- for dir in "$work_dir"/iso/"$dir_prefix"* ; do
- rm -r "$dir"
- done
- mkdir -p "$work_dir"/iso/"${dir_prefix}_${filename%.iso}"
- dpkg -l | egrep "ii|hi" | awk '{ print $2 }' > "$work_dir"/iso/"${dir_prefix}_${filename%.iso}"/package_list
- # Add the Release Notes to the iso
- if [[ -f /usr/share/doc/_Release_Notes/Release_Notes ]] ; then
- rsync -a /usr/share/doc/_Release_Notes/Release_Notes "$work_dir"/iso/
- fi
- }
- set_boot_options () {
- # Create the boot menu unless iso_dir is not default.
- if [ "$iso_dir" = "/usr/lib/refractasnapshot/iso" ] ; then
- sed -i "s:\${DISTRO}:$DISTRO:g" "$work_dir"/iso/isolinux/"$boot_menu"
- sed -i "s:\${netconfig_opt}:$netconfig_opt:g" "$work_dir"/iso/isolinux/"$boot_menu"
- sed -i "s:\${ifnames_opt}:$ifnames_opt:g" "$work_dir"/iso/isolinux/"$boot_menu"
- sed -i "s:\${username_opt}:$username_opt:g" "$work_dir"/iso/isolinux/"$boot_menu"
- fi
- if [[ $make_efi = "yes" ]] ; then
- sed -i "s:\${DISTRO}:$DISTRO:g" "$work_dir"/iso/boot/grub/grub.cfg
- sed -i "s:\${netconfig_opt}:$netconfig_opt:g" "$work_dir"/iso/boot/grub/grub.cfg
- sed -i "s:\${username_opt}:$username_opt:g" "$work_dir"/iso/boot/grub/grub.cfg
- sed -i "s:\${ifnames_opt}:$ifnames_opt:g" "$work_dir"/iso/boot/grub/grub.cfg
- fi
- }
- edit_boot_menus () {
- if [[ $edit_boot_menu = "yes" ]]; then
- echo $"
- You may now go to another virtual console to edit any files in the work
- directory, or hit ENTER and edit the boot menu.
- "
- read -p " "
- "$text_editor" "$work_dir"/iso/isolinux/"$boot_menu"
- if [[ $make_efi = "yes" ]] ; then
- "$text_editor" "$work_dir"/iso/boot/grub/grub.cfg
- fi
- fi
- }
- squash_filesystem () {
- echo "Squashing the filesystem..."
- if [[ $limit_cpu = "yes" ]] ; then
- [[ $(type -p cpulimit) ]] || \
- while true ; do
- echo -n $"
- The cpulimit program is not installed. Your CPU will not be limited.
- Would you like to continue anyway? (y/N)
- "
- read ans
- case $ans in
- [Yy]*) break ;;
- *) exit 0 ;;
- esac
- done
- cpulimit -e mksquashfs -l "$limit" &
- pid="$!"
- fi
- mksquashfs myfs/ iso/live/filesystem.squashfs ${mksq_opt} -noappend
- if [[ -n "$pid" ]] ; then
- kill "$pid"
- fi
- # This code is redundant, because $work_dir gets removed later, but
- # it might help by making more space on the hard drive for the iso.
- if [[ $save_work = "no" ]]; then
- rm -rf myfs
- fi
- }
- make_iso_fs () {
- # create the iso file, make it isohybrid
- # create sha256sum file for the iso
- echo $"Creating CD/DVD image file..."
- # If isohdpfx.bin gets moved again, maybe use: isohdpfx=$(find /usr/lib/ -name isohdpfx.bin)
- if [[ $make_isohybrid = "yes" ]]; then
- if [[ -f /usr/lib/syslinux/mbr/isohdpfx.bin ]] ; then
- isohybrid_opt="-isohybrid-mbr /usr/lib/syslinux/mbr/isohdpfx.bin"
- elif [[ -f /usr/lib/syslinux/isohdpfx.bin ]] ; then
- isohybrid_opt="-isohybrid-mbr /usr/lib/syslinux/isohdpfx.bin"
- elif [[ -f /usr/lib/ISOLINUX/isohdpfx.bin ]] ; then
- isohybrid_opt="-isohybrid-mbr /usr/lib/ISOLINUX/isohdpfx.bin"
- else
- echo $"Can't create isohybrid. File: isohdpfx.bin not found. The resulting image will be a standard iso file."
- fi
- fi
- [[ -n "$volid" ]] || volid="liveiso"
- xorriso -as mkisofs -r -J -joliet-long -l -iso-level 3 ${isohybrid_opt} \
- -partition_offset 16 -V "$volid" -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot \
- -boot-load-size 4 -boot-info-table ${uefi_opt} -o "$snapshot_dir"/"$filename" iso/
- if [[ $make_sha256sum = "yes" ]]; then
- cd "$snapshot_dir"
- sha256sum "$filename" > "$filename".sha256
- cd "$work_dir"
- fi
- }
- cleanup () {
- if [[ $save_work = "no" ]]; then
- echo $"Cleaning..."
- cd /
- rm -rf "$work_dir"
- #else
- # rm "$work_dir"/iso/live/filesystem.squashfs
- fi
- }
- final_message () {
- echo -e $"\n\tAll finished!\n"
- }
- ######################################
- check_grub
- choose_task
- _____________________________________________
- /etc/refractasnapshot.com
- (default, as-shipped)
- # This file contains some configuration variables for Refracta Snapshot
- # (version 10.2.x GUI and CLI versions). If you want to change
- # the defaults, this is the place to do it.
- #
- # Put this file in /etc or edit the configfile variable found at the
- # top of refractasnapshot to reflect its true location. If the
- # script can't find this config file, it'll use the default values.
- # Copyright 2011-2018 [email protected]
- # Some laptops overheat when running rsync or mksquashfs. If limit_cpu
- # is "yes", cpu activity will be limited on those two commands.
- # limit is percentage of cpu allowed for command, up to 100% per core.
- limit_cpu="no"
- limit="50"
- # Default location for error log is /var/log/refractasnashot.log
- error_log="/var/log/refractasnapshot.log"
- # You can change the location of $work_dir (location of system copy) and
- # $snapshot_dir (location of final iso file) in case you don't have enough
- # space on the system. (Defaults are "/home/work" and "/home/snapshot")
- #
- # Hints:
- # Be sure to use separate directories for these two variables. If you
- # use the same location for both (e.g. /media/disk) and if $save_work
- # is set to "no", your CD image will get deleted when the program
- # finishes. Instead, use something like /media/disk/snapshot and
- # /media/disk/work, or even /media/disk/snapshot/work.
- # These directories will be created by the script, and they are
- # already set to be excluded from the rsync copy of the system (so you
- # don't end up with an extra copy of your system or old snapshots in the
- # final CD image.)
- # Any filesystems mounted in /mnt or /media will be excluded from the
- # system copy. Filesystems mounted elsewhere will be included and will
- # increase the size of the final CD image. To avoid that, you can either
- # unmount those filesystems before running refractasnapshot, or you can
- # add them to the excludes file. (See snapshot_excludes below.)
- snapshot_dir="/home/snapshot"
- work_dir="/home/work"
- efi_work="${work_dir}/efi-files"
- # Set to yes to create boot files for uefi.
- make_efi="yes"
- # Set to force xorriso to use $uefi_opt (for testing only)
- force_efi="no"
- # Change $save_work to "yes" if you want the temporary copy of your
- # filesystem to be saved. This will make subsequent snapshot creation
- # go faster.
- # (Default is "no")
- save_work="no"
- # rsync delete options (or any others you want to add)
- # This is only for copy_filesystem() and only if $save_work is "yes"
- # Use only one option per variable!
- # Default options are --delete-before and --delete-excluded
- # Full command in the script is:
- # rsync -av / myfs/ ${rsync_option1} ${rsync_option12} ${rsync_option3} \
- # --exclude="$work_dir" --exclude="$snapshot_dir" --exclude="$efi_work" --exclude-from="$snapshot_excludes"
- rsync_option1="--delete-before"
- rsync_option2=" --delete-excluded"
- rsync_option3=""
- # You can change the default rsync excludes file here if you know what
- # you're doing. Be sure to use the full path to the file.
- #
- # It's also possible to edit the excludes file by choosing "Setup"
- # during the execution of the script.
- #
- # Default is "/usr/lib/refractasnapshot/snapshot_exclude.list"
- snapshot_excludes="/usr/lib/refractasnapshot/snapshot_exclude.list"
- # Change this if you want the live system to use other than the default
- # kernel and initrd. You may need to edit the isolinux boot menu to
- # match the filenames. (Also see custom boot menu section below.)
- # Example: for kernel_image="/boot/vmlinuz-3.16.0-4-amd64" then the kernel
- # line in the boot menu would contain:
- # kernel /live/vmlinuz-3.16.0-4-amd64
- #
- # (Defaults are /vmlinuz and /initrd.img)
- kernel_image="/vmlinuz"
- initrd_image="/initrd.img"
- # Multiple snapshots (iso files) are named with the date and time of
- # creation. If you prefer to have them numbered sequentially, comment
- # out the next line. Default is to keep the line uncommented.
- stamp="datetime"
- # The name of the snapshot file will be snapshot-{date or number}.iso.
- # If you'd like to replace "snapshot" with something more memorable,
- # change it here. (example: snapshot_basename="refracta-nox-wheezy")
- # volid is the volume label on the finished (burned) CD, DVD or USB.
- snapshot_basename="snapshot"
- volid="liveiso"
- # Change to "no" if you don't want the sha256sum file created with the iso.
- # (Default is "yes")
- make_sha256sum="yes"
- # Change to "no" if you want a plain iso image instead of isohybrid.
- # (Default is "yes")
- make_isohybrid="yes"
- # Uncomment one of the lines below to use xz compression for smaller iso.
- # small and slow
- #mksq_opt="-comp xz"
- # smaller and slower:
- #mksq_opt="-comp xz -Xbcj x86"
- ####################################
- # Turn stuff on and off section
- # Allow users to mount all fixed drives with pmount for live iso.
- # Refractainstaller removes this upon installation.
- # (Default is "yes")
- pmount_fixed="yes"
- # update the mlocate database before copying filesystem.
- update_mlocate="yes"
- # Clear list of recently used files in geany for primary user.
- # Default is "yes"
- clear_geany="yes"
- # Allow password login to ssh for users (not root).
- # If ssh_pass="yes", then PasswordAuthentication will be set to "yes"
- # If ssh_pass="no", then PasswordAuthentication will be set to "no"
- # In either of the above cases, if PermitRootLogin was set to "yes",
- # it will be changed to "prohibit-password" (meaning with auth keys only)
- # If ssh_pass is null or set to anything other than "yes" or "no", then
- # /etc/ssh/sshd_config will not be altered.
- ssh_pass="yes"
- ########################################################
- # Custom boot menu and help files section.
- # If you're running refractasnapshot on some linux distribution other
- # than Refracta, You might also want to edit or remove some of the help
- # files in the isolinux directory. (f1.txt, f2.txt...)
- # If you want those changes to persist between runs, you should create
- # a custom iso/isolinux directory, and set iso_dir (below) to point
- # to that directory.
- # If the primary user's name is not "user", then live-boot needs to see
- # the user's name in the boot command. In that case, the script will
- # automatically add the correct option. If you set a user name here, it
- # will override that process. Use this if you want to log into the live
- # media as someone other than the primary user (i.e. any user whose
- # uid:gid are not 1000:1000.)
- # Under most circumstances, leave this blank or commented out.
- #username=""
- # Change to "yes" if you want to be able to view or edit the boot menu
- # or any other config files before the final image is made.
- # Note2: For SolusOS and possibly others, boot entries should contain
- # "union=unionfs" in place of "union=aufs".
- # Note3: For anything later than jessie, union=aufs should be removed
- # or possibly replaced with union=overlay
- edit_boot_menu="no"
- # EDITOR SETTINGS
- # This gets used if you set edit_boot_menu="yes" or if you run setup
- # and choose to edit the config file or the excludes file.
- # Use an absolute path here.
- # (example: text_editor="/usr/bin/nano)"
- # Command-line editor (for refractasnapshot)
- text_editor="$(type -p nano)"
- # Graphical editor (for refractasnapshot-gui)
- # Program tests for geany, gedit, kate, kwrite, leafpad, medit, mousepad, pluma
- # You can specify an editor here if needed.
- # other_editor_option is used to force a new instance of the editor.
- other_editor=""
- other_editor_option=""
- # You can change iso_dir if you want to use customized files for the
- # boot menu and boot help pages on the live-cd.
- # Note:
- # If you're using custom versions (different from what's installed
- # on your system) of isolinux.bin and vesamenu.c32, you'll need to edit
- # or comment out the rsync commands in the script that copy these two
- # files from your system to the work directory. To find the lines, see
- # /usr/bin/refractasnapshot or /usr/bin/refractsnapshot-gui for the
- # copy_isolinux function, around line 520 or 630, respectively.
- # (Default is "/usr/lib/refractasnapshot/iso")
- # DO NOT USE A TRAILING SLASH HERE!!!"
- iso_dir="/usr/lib/refractasnapshot/iso"
- # Change this if you're using customized boot menu files, AND your
- # menu file is other than the default, live.cfg, AND you set
- # $edit_boot_menu to "yes".
- boot_menu="live.cfg"
- # grub_template gets used for uefi live boot menu.
- grub_template="/usr/lib/refractasnapshot/grub.cfg.template"
- # Uncomment this to add boot help files specific to the Refracta distribution.
- # Otherwise, generic help files, mostly empty, will be used. If you want
- # to use your own customized files, see iso_dir settings above.
- #refracta_boot_help="yes"
- # Prepare the initrd to support encrypted volumes. Uncomment this
- # if you plan to use the snapshot on a live usb with an encrypted
- # persistent volume. This will edit /etc/cryptsetup-initramfs/conf-hook
- # to set CRYPTSETUP=y
- #initrd_crypt="yes"
- # Uncomment to include your network configuration in the snapshot.
- # This will preserve your /etc/network/interfaces and any saved wireless
- # configurations. This works for NetworkManager, simple-netaid/netman
- # and wicd.
- # It will also add "ip=frommedia" to the boot command, so that the saved
- # configuration will be used.
- # Default is commented; interfaces file in $work_dir/myfs gets replaced
- # and only contains the loopback interface.
- #
- # NOTE!!! If you're using some other network manager, and you don't want
- # your configs to be copied, you need to add the appropriate files to
- # the excludes list. (Tell me what those files are, and I'll fix
- # refractasnapshot to handle it.)
- #netconfig_opt="ip=frommedia"
- # Uncomment to use old or new style interface names.
- # Use net.ifnames=0 to force old interface names with udev. (eth0)
- # Use net.ifnames=1 to force new interface names with eudev. (enp0s1)
- #ifnames_opt="net.ifnames=0"
- # Snapshot Help text
- snapshot_help="/usr/share/doc/refractasnapshot-base/readme.refractasnapshot.txt.gz"
- # DEPRECATED:
- # This patch is no longer needed. Instead, the script will create some
- # files in /dev to help with booting. If you leave this variable set
- # to "yes" the script will check for previous application of the patch
- # and give you the chance to edit the file manually. If you don't remove
- # the lines that were added by the patch, nothing bad will happen.
- #
- #
- # Debian Jessie systems without systemd and with util-linux-2.25 will
- # create an unbootable iso. The workaround is to add a few lines to
- # /usr/share/initramfs-tools/init and then rebuild the initrd.
- # If this option is set to "yes" then the script will check for systemd
- # and for the version of util-linux. If needed, the script will apply
- # the patch and rebuild the initrd.
- #
- # Warning: If you also need to run the nocrypt.sh script because you're
- # creating a snapshot from a system INSTALLED ON AN ENCRYPTED PARTITION,
- # you need to run nocrypt.sh after letting this patch run. (Hint: you
- # can abort the snapshot run at the Disk Space Report, run nocrypt,
- # then make your snapshot.)
- #
- # Default is "no" or commented out.
- #patch_init_nosystemd="yes"
- _____________________________________________
- within the debfile, the to-be-installed copy of
- /usr/share/doc/refractasnapshot-base/README (is from v10.0, so not entirely up-to-date).
- Below, I'm pasting the content of
- /usr/share/doc/refractasnapshot-base/readme.refractasnapshot.txt.gz
- v. 10.2.0+
- Refracta Snapshot creates a bootable live-CD image which is a copy of
- your running system. Any changes you make to the running system,
- including desktop preferences, configuration changes, or added software
- will be copied to the snapshot and will be present when you run that
- snapshot as a live system.
- See the config file, /etc/refractasnapshot.conf for setting options.
- The config file is the most up-to-date and detailed documentation.
- See the excludes file, /usr/lib/refractasnapshot/snapshot_exclude.list
- to examine which files and directories will not be copied to the
- snapshot. Edit the file as needed, either by adding items or commenting
- out listed items that you want copied.
- As of version 9.0.8, you can edit the config and excludes files from
- within the gui program by choosing "Setup".
- To run the script:
- refractasnapshot
- or
- refractasnapshot-gui
- or use the full path if needed:
- /usr/bin/refractasnapshot(-gui)
- COMMAND LINE OPTIONS
- -h, --help show help
- -v, --version display the version information
- -c, --config specify a different config file
- (file name must be next argument)
- -d, --debug run in debug mode (set -x)
- TROUBLESHOOTING
- Run refractasnapshot or refractasnapshot-gui with the '-d' option and
- save /var/log/refractasnapshot.log for analysis.
- NOCOPY OPTION
- The nocopy option has been replaced with an options menu in the script.
- 1. Create a snapshot
- - This runs the full process to create a snapshot, consisting of
- rsync copy to create the live filesystem
- copy isolinux boot files
- create efi boot files
- squash the live filesystem
- put it all into a bootable iso file.
- 2. Re-squash and make iso (no-copy)
- - For manual changes to the live filesystem in $work_dir/myfs.
- 3. Re-make efi files and iso (no-copy, no-squash)
- - Maybe for hacking on the mkefi function in the script.
- 4. Re-run xorriso only (make iso, no-copy, no-squash)
- - For manual changes to any files in the root of the live media,
- such as boot menus or boot help files in $work_dir/iso.
- The nocopy options will prevent rsync from updating the saved copy of the
- filesystem. Any system changes or updates that occurred after the copy
- was made will not be included in the final image.
- The nocopy options are for special purposes (for example, you made changes
- to the saved copy of the filesystem after a previous snapshot, and you
- don't want those changes overwritten by the running system.)
- However, you must have save_work=yes and have a previously saved copy of
- the filesystem for nocopy to work.
- CREATING A SNAPSHOT FROM AN ENCRYPTED SYSTEM OR SWAP PARTITION
- If your host system is encrypted or has a swap partition, the script
- will edit the snapshot's initrd to remove conf/conf.d/cryptroot and/or
- conf/conf.d/resume so that the snapshot iso will boot successfully.
- This will NOT affect the initrd on the host system.
- CREATING A SNAPSHOT TO BE USED WITH ENCRYPTED PERSISTENCE
- If you want to create an iso that will be used to make a live-usb with
- an encrypted volume for persistence, you need to rebuild the initrd to
- include cryptsetup if it's missing. This is now automatic.
- - Uncomment the line in /etc/refractasnapshot.conf that contains:
- initrd_crypt="yes"
- The script will check for cryptsetup in the initrd, and if necessary
- will edit /etc/cryptsetup-initramfs/conf-hook to set CRYPTSETUP=y.
- This DOES change the host's initrd. To revert the change in the host,
- comment out the line and run 'update-initramfs -u'.
- Assumptions: The kernel you're running is the one that you will use in
- the snapshot. (i.e. /initrd.img)
- NETWORK CONFIGURATIONS
- If you want custom network configurations to be copied into the snapshot,
- uncomment the line in the config file that has:
- netconfig_opt="ip=frommedia"
- This will preserve your /etc/network/interfaces and any saved wireless
- configurations. This works for NetworkManager, simple-netaid/netman
- and wicd. It will also add "ip=frommedia" to the boot command, so that
- the saved configuration will be used in the live system.
- If you leave the line commented, the default behavior is to
- replace the interfaces file with one that only has the loopback interface
- configured and to delete any saved wireless configurations.
- (This only affects the filesystem copy in $work_dir/myfs.)
- NOTE!!! If you're using some other network manager, and you don't want
- your configs to be copied, you need to add the appropriate files to
- the excludes list. (Tell me what those files are, and I'll fix
- refractasnapshot to handle it.)
- NETWORK INTERFACE NAMES
- To control whether the snapshot uses old network interface names like
- eth0 or new names like enp0s1, uncomment and set ifnames_opt in the
- config file.
- Use net.ifnames=0 to force old interface names with udev. (eth0)
- Use net.ifnames=1 to force new interface names with eudev. (enp0s1)
- ______________________________________________
Advertisement
Add Comment
Please, Sign In to add comment