# HG changeset patch # User Aleksej Bobylev # Date 1439078174 -10800 # Node ID 3ae895c89885470f1607a9403fbbf1cd346f1bed # Parent 8ddffadf56a6f717cda50ddac4d0256559226487 tazusb: extend to "tazusb writefs [compression] [path]" diff -r 8ddffadf56a6 -r 3ae895c89885 po/tazusb/el.po --- a/po/tazusb/el.po Sat Aug 01 22:49:04 2015 +0300 +++ b/po/tazusb/el.po Sun Aug 09 02:56:14 2015 +0300 @@ -300,8 +300,8 @@ "για τις καθυστερημένες εγγραφές!" #: tazusb:541 -msgid "%s is located in /" -msgstr "Το %s τοποθετήθηκε στο /" +msgid "%s is located in %s" +msgstr "Το %s τοποθετήθηκε στο %s" #: tazusb:545 #, fuzzy diff -r 8ddffadf56a6 -r 3ae895c89885 po/tazusb/fr.po --- a/po/tazusb/fr.po Sat Aug 01 22:49:04 2015 +0300 +++ b/po/tazusb/fr.po Sun Aug 09 02:56:14 2015 +0300 @@ -286,8 +286,8 @@ "les écritures différées." #: tazusb:541 -msgid "%s is located in /" -msgstr "Le fichier %s est dans /" +msgid "%s is located in %s" +msgstr "Le fichier %s est dans %s" #: tazusb:545 #, fuzzy diff -r 8ddffadf56a6 -r 3ae895c89885 po/tazusb/pl.po --- a/po/tazusb/pl.po Sat Aug 01 22:49:04 2015 +0300 +++ b/po/tazusb/pl.po Sun Aug 09 02:56:14 2015 +0300 @@ -289,8 +289,8 @@ "proszę pamiętać aby odmontować urządzenie przed odłączeniem od komputera!" #: tazusb:541 -msgid "%s is located in /" -msgstr "%s jest zlokalizowany w /" +msgid "%s is located in %s" +msgstr "%s jest zlokalizowany w %s" #: tazusb:545 msgid "Root filesystem size: %s" diff -r 8ddffadf56a6 -r 3ae895c89885 po/tazusb/pt_BR.po --- a/po/tazusb/pt_BR.po Sat Aug 01 22:49:04 2015 +0300 +++ b/po/tazusb/pt_BR.po Sun Aug 09 02:56:14 2015 +0300 @@ -278,8 +278,8 @@ msgstr "Movendo %s para a mídia. Lembre-se de desmontar o dispositivo!" #: tazusb:541 -msgid "%s is located in /" -msgstr "%s localizado em /" +msgid "%s is located in %s" +msgstr "%s localizado em %s" #: tazusb:545 #, fuzzy diff -r 8ddffadf56a6 -r 3ae895c89885 po/tazusb/ru.po --- a/po/tazusb/ru.po Sat Aug 01 22:49:04 2015 +0300 +++ b/po/tazusb/ru.po Sun Aug 09 02:56:14 2015 +0300 @@ -287,8 +287,8 @@ "записи!" #: tazusb:541 -msgid "%s is located in /" -msgstr "Файл %s расположен в /" +msgid "%s is located in %s" +msgstr "Файл %s расположен в %s" #: tazusb:545 msgid "Root filesystem size: %s" diff -r 8ddffadf56a6 -r 3ae895c89885 po/tazusb/tazusb.pot --- a/po/tazusb/tazusb.pot Sat Aug 01 22:49:04 2015 +0300 +++ b/po/tazusb/tazusb.pot Sun Aug 09 02:56:14 2015 +0300 @@ -268,7 +268,7 @@ msgstr "" #: tazusb:541 -msgid "%s is located in /" +msgid "%s is located in %s" msgstr "" #: tazusb:545 diff -r 8ddffadf56a6 -r 3ae895c89885 po/tazusb/zh_CN.po --- a/po/tazusb/zh_CN.po Sat Aug 01 22:49:04 2015 +0300 +++ b/po/tazusb/zh_CN.po Sun Aug 09 02:56:14 2015 +0300 @@ -274,8 +274,8 @@ msgstr "移动%s到LiveUSB媒体。请记住取消延迟写入!" #: tazusb:541 -msgid "%s is located in /" -msgstr "%s位于 /" +msgid "%s is located in %s" +msgstr "%s位于 %s" #: tazusb:545 #, fuzzy diff -r 8ddffadf56a6 -r 3ae895c89885 tazusb --- a/tazusb Sat Aug 01 22:49:04 2015 +0300 +++ b/tazusb Sun Aug 09 02:56:14 2015 +0300 @@ -13,7 +13,7 @@ . /lib/libtaz.sh -# Export package name for gettext. +# i18n export TEXTDOMAIN='tazusb' COMMAND="$1" @@ -102,21 +102,6 @@ } -# Format target device and label partition. - -mkfs_ext3() { - _n 'Please specify a label for the partition (TazUSB): ' - read label - - [ -z "$label" ] && label='TazUSB' - - _ 'Label: %s' "$label" - echo "Mkfs: mkfs.ext3 -L \"$label\" $DEVICE" - newline; sleep 2 - mkfs.ext3 -L "$label" $DEVICE -} - - # Get label for device get_label() { @@ -126,6 +111,18 @@ } +# Format target device and label partition. + +mkfs_ext3() { + get_label + + _ 'Label: %s' "$label" + echo "Mkfs: mkfs.ext3 -L \"$label\" $DEVICE" + newline; sleep 2 + mkfs.ext3 -L "$label" $DEVICE +} + + # Get fs type. Supported fs are ext3, ext2, fat32 get_fs_type() { @@ -370,9 +367,8 @@ # will activate it, useful for low memory systems gen_swap_file() { - newline - boldify "$(_n 'Gen swap')" - separator + title "$(_n 'Gen swap')" + longline "$(_ "Generate a swap file in %s that will be activated on each \ boot to have more memory available (empty value to exit)." '/home/swap')" newline @@ -399,9 +395,8 @@ # Clean out old backups to save disk space clean_usb() { - newline - boldify "$(_n 'Clean')" - separator + title "$(_n 'Clean')" + longline "$(_n 'Remove old %s backup filesystems to free up disk space.' \ 'rootfs.gz.unixtimestamp')" newline @@ -429,19 +424,22 @@ writefs) # Writefs to rootfs.gz check_root - if [ -z "$2" ]; then - COMPRESSION='none' - else - COMPRESSION="$2" - fi + # Compression type (optional): lzma, gzip, none. Default is none + COMPRESSION="${2:-none}" + # Full path to rootfs.gz (optional). Default is /rootfs.gz + ROOTFS_PATH="${3:-/rootfs.gz}" + # File name + ROOTFS="$(basename "$ROOTFS_PATH")" + # Start info title 'Write filesystem' longline "$(_ "The command writefs will write all the current \ filesystem into a suitable cpio archive (%s) usable on a bootable \ -LiveUSB media." 'rootfs.gz')" +LiveUSB media." "$ROOTFS")" newline _ 'Archive compression: %s' "$(colorize 36 "$COMPRESSION")" + newline # Clear out tazpkg cache rm /var/lib/tazpkg/*.bak /var/cache/tazpkg/* -r -f @@ -449,8 +447,8 @@ # Optionally remove sound card selection and screen resolution. _ 'Do you wish to remove the sound card and screen configs?' _n 'Press ENTER to keep or answer (No|yes|exit): ' - read anser - case $anser in + read answer + case $answer in e|E|"exit"|Exit) exit 0 ;; y|Y|yes|Yes) @@ -467,8 +465,8 @@ # Optionally remove i18n settings _ 'Do you wish to remove local/keymap settings?' _n 'Press ENTER to keep or answer (No|yes|exit): ' - read anser - case $anser in + read answer + case $answer in e|E|"exit"|Exit) exit 0 ;; y|Y|yes|Yes) @@ -481,6 +479,7 @@ sed -i 's/^INCLUDE i18n.cfg/# &/' /home/boot/*linux/*linux.c* ;; esac status + newline # Clean-up files by default mv -f /var/log/wtmp /tmp/tazusb-wtmp @@ -508,37 +507,40 @@ done # Generate initramfs with specified compression - if [ "$COMPRESSION" == 'lzma' ]; then - _n 'Creating %s with lzma compression... ' 'rootfs.gz' - cpio -o -H newc | lzma e -si -so > /rootfs.gz - - elif [ "$COMPRESSION" == 'gzip' ]; then - _n 'Creating %s with gzip compression... ' 'rootfs.gz' - cpio -o -H newc | gzip -9 > /rootfs.gz - - else - _n 'Creating %s without compression... ' 'rootfs.gz' - cpio -o -H newc > /rootfs.gz - fi < /tmp/list + case "$COMPRESSION" in + lzma) + _n 'Creating %s with lzma compression... ' "$ROOTFS" + cpio -o -H newc | lzma e -si -so > "$ROOTFS_PATH" + ;; + gzip) + _n 'Creating %s with gzip compression... ' "$ROOTFS" + cpio -o -H newc | gzip -9 > "$ROOTFS_PATH" + ;; + *) + _n 'Creating %s without compression... ' "$ROOTFS" + cpio -o -H newc > "$ROOTFS_PATH" + ;; + esac < /tmp/list mv -f /tmp/tazusb-wtmp /var/log/wtmp # Get initramfs size - size=$(du -sh /rootfs.gz | cut -f1) + size=$(du -sh "$ROOTFS_PATH" | cut -f1) # If the bootable medium is where it should be, copy across - if (test -e /home/boot/bzImage); then - longline "$(_ 'Moving %s to media. Remember to unmount for delayed writes!' 'rootfs.gz')" + if [ -e /home/boot/bzImage ]; then + longline "$(_ 'Moving %s to media. Remember to unmount for delayed writes!' "$ROOTFS")" # Move the old filesystem with the unix timestamp for reference - if (test -e /home/boot/previous.gz); then + if [ -e /home/boot/previous.gz ]; then mv /home/boot/previous.gz /home/boot/rootfs.gz.$(date +%s) fi mv /home/boot/rootfs.gz /home/boot/previous.gz - mv /rootfs.gz /home/boot/. + mv "$ROOTFS_PATH" /home/boot/rootfs.gz + _ '%s is located in %s' 'rootfs.gz' '/home/boot' else - _ '%s is located in /' 'rootfs.gz' + _ '%s is located in %s' "$ROOTFS" "$(dirname "$ROOTFS_PATH")" fi separator diff -r 8ddffadf56a6 -r 3ae895c89885 tazusb-box --- a/tazusb-box Sat Aug 01 22:49:04 2015 +0300 +++ b/tazusb-box Sun Aug 09 02:56:14 2015 +0300 @@ -27,7 +27,7 @@ opts="--window-icon=$icon --height=220 --width=520 --center --on-top" -# I18n +# i18n export TEXTDOMAIN='tazusb-box' @@ -54,7 +54,7 @@ list_devices() { if [ -d /proc/scsi/usb-storage ]; then - dev="$(blkid | cut -d":" -f1)" + dev="$(blkid | cut -d: -f1)" echo $dev | sed s'/ /!/'g else _ 'No USB media found' @@ -92,7 +92,7 @@ exit 0 fi if echo "$main" | grep -q ".iso|"; then - iso=$(echo $main | cut -d "|" -f 1) + iso=$(echo $main | cut -d "|" -f1) yes '' | tazusb gen-iso2usb $iso $dev --output=raw | output else yes '' | tazusb gen-liveusb $dev --output=raw | output