diff options
-rw-r--r-- | copyiso2usb.1 (renamed from usr/share/man/man1/copyiso2usb.1) | 0 | ||||
-rw-r--r-- | copyiso2usb.desktop (renamed from usr/share/applications/copyiso2usb.desktop) | 0 | ||||
-rw-r--r-- | copyiso2usb.png (renamed from usr/share/icons/copyiso2usb.png) | bin | 1666 -> 1666 bytes | |||
l--------- | usr/bin/copyiso2usb | 1 | ||||
-rwxr-xr-x | usr/sbin/copyiso2usb | 323 | ||||
-rw-r--r-- | usr/share/locale/id/LC_MESSAGES/copyiso2usb.mo | bin | 3110 -> 0 bytes | |||
-rw-r--r-- | usr/share/locale/uk/LC_MESSAGES/copyiso2usb.mo | bin | 4232 -> 0 bytes | |||
-rw-r--r-- | usr/share/man/id/man1/copyiso2usb.1 | 21 | ||||
-rw-r--r-- | usr/share/man/uk/man1/copyiso2usb.1 | 21 |
9 files changed, 0 insertions, 366 deletions
diff --git a/usr/share/man/man1/copyiso2usb.1 b/copyiso2usb.1 index afd5f5c..afd5f5c 100644 --- a/usr/share/man/man1/copyiso2usb.1 +++ b/copyiso2usb.1 diff --git a/usr/share/applications/copyiso2usb.desktop b/copyiso2usb.desktop index cd91612..cd91612 100644 --- a/usr/share/applications/copyiso2usb.desktop +++ b/copyiso2usb.desktop diff --git a/usr/share/icons/copyiso2usb.png b/copyiso2usb.png Binary files differindex 6eb0a58..6eb0a58 100644 --- a/usr/share/icons/copyiso2usb.png +++ b/copyiso2usb.png diff --git a/usr/bin/copyiso2usb b/usr/bin/copyiso2usb deleted file mode 120000 index ed9d1b0..0000000 --- a/usr/bin/copyiso2usb +++ /dev/null @@ -1 +0,0 @@ -/usr/bin/consolehelper
\ No newline at end of file diff --git a/usr/sbin/copyiso2usb b/usr/sbin/copyiso2usb deleted file mode 100755 index 19127bc..0000000 --- a/usr/sbin/copyiso2usb +++ /dev/null @@ -1,323 +0,0 @@ -#!/bin/bash -######################################################################################## -# /usr/sbin/copyiso2usb -######################################################################################## -# Usage: copyiso2usb [isofile] -# Installs needed packages if missing - dcfldd cdialog udisks mlocate -# Runs locate command if needed mmlocate.db doesn't exist, or is more than 24 hours -# old, or requested. -# Uses the locate command to find iso images, presented in a selection dialog, unless -# a file name is passed as the only argument. -# Lists usb drives in a selection dialog -# Checks that the iso will fit on the selected drive -# Confirms that the command should be run -# Copies the iso image to the usb drive. -# -# Note for maintainers 'xgettext -d copyiso2usb -L Shell /usr/sbin/copyiso2usb' used -# to create copyiso2usb.po (which was manually renamed to copyiso2usb.pot) -# -# If installing manually, also suggest installing Xdialog and runnning -# 'ln -s /usr/bin/consolehelper /usr/sbin/copyiso2usb' -######################################################################################## -# Author: David W. Hodgins - Mageia Qa team -# 2013-06-02 Initial writing -# 2013-06-04 Added iso as arg, fix for no partition table on usb stick, Thanks barjac. -# 2013-08-22 Converted to use gettext for translations -######################################################################################## -set -u # Show usage of unset variables as an error, to help catch typos. -# Obtain translations for all static messages (message with vars translated when needed) -. /usr/bin/gettext.sh -TEXTDOMAIN=copyiso2usb -export TEXTDOMAIN -TEXTDOMAINDIR=/usr/share/locale/ -export TEXTDOMAINDIR -Newline="\n" -TitleString=$(gettext "Copy iso image to usb drive") -SelectISO=$(gettext "Select iso image to be copied to a usb drive") -NoISOFound=$(eval_gettext "No iso images found.\${Newline}\${Newline}If an iso has been recently downloaded, please run /etc/cron.daily/mlocate.cron\${Newline}so that this script can find them using the locate command.") -NoUSBDrives=$(eval_gettext "No usb drives found.\${Newline}\${Newline}Please insert a usb drive, and then rerun this script.") -SelectUSBDrive=$(gettext "Select usb drive to copy the iso image to") -CopyCancelled=$(gettext "Copy cancelled. Exiting.") -Waitmlocate=$(gettext "Running /etc/cron.daily/mlocate.cron. Please wait for 'rc=0' before continuing.") -WaitCopy=$(gettext "Copying iso to usb drive. Please wait for 'rc=0' before continuing.") -FileNameTemp=$(mktemp -p /tmp "${0##*/}".XXXXXX) - -# Set dialog command to use -dialogcmd="/usr/bin/Xdialog" -displaytest=${DISPLAY-"unset"} -if [ ! -e /usr/bin/Xdialog ] || [ ! -x /usr/bin/Xdialog ] || [ "unset" = "$displaytest" ] ; then - dialogcmd="/usr/bin/dialog" -fi - -ThisScript="$0" -if [[ ! ${ThisScript:0:1} = '/' ]] ; then - ThisScript="$(pwd)/$0" -fi - -# Function to get window size -GetDisplaySize() { - IFS=$':, ' - read label MaxLines MaxColumns<<<"$($dialogcmd --print-maxsize --output-fd 1 2>&1)" - unset IFS - MenuHeight=$(( MaxLines - 5 )) -} - -GetDisplaySize - -# Function to list all usb drives -listusbdrives () { - for block in /sys/devices/pci*/*/usb*/*/*/host*/target*/*/block/sd*; do - device=${block##*/} # strip last slash and everything before it. - printf '%s\n' "$device" - done -} - -menuitem=0 -MenuText="" -DisplayMenu() { - GetDisplaySize - $dialogcmd --backtitle "$TitleString" --title "copyiso2usb" --menu "$DisplayText" "$MaxLines" "$MaxColumns" "$MenuHeight" $MenuText 2>$FileNameTemp -} - -DisplayInfo() { - GetDisplaySize - $dialogcmd --backtitle "$TitleString" --title "copyiso2usb" --msgbox "$DisplayText" "$MaxLines" "$MaxColumns" -} - -RunCommandX() { - GetDisplaySize - printf '%s\n\n' "$DisplayText" >$FileNameTemp - ( printf '%s\n' "$@" ; eval "$@" ; result=$? ; printf '%s\n' "rc=$result" ) >>$FileNameTemp & - $dialogcmd --backtitle "$TitleString" \ - --title "copyiso2usb" \ - --tailbox "$FileNameTemp" "$MaxLines" "$MaxColumns" - rm -f "$FileNameTemp" -} - -RunCommand() { - if [[ "$dialogcmd" = "/usr/bin/dialog" ]] ; then - printf '%s\n\n' "$DisplayText" - eval "$@" - result=$? - printf '%s\n' "rc=$result" - else - RunCommandX "$@" - fi -} - -ShowMsgExit() { - DisplayText="$@" - DisplayInfo - exit 0 -} - -# Function to install missing packages -InstallPackageIfFileMissing() { -# Install command, if it isn't already available - if [ ! -x "$1" ] ; then - Command="$1" - Package="$2" - CmdNotFoundInstalling=$(eval_gettext "\$Command command not found. Installing \$Package") - DisplayText="$CmdNotFoundInstalling" - RunCommand "urpmi --auto $2" - result=$? - if (($result)) ; then - FailedExiting=$(eval_gettext "urpmi failed. Return code was \$result. Exiting.") - ShowMsgExit "$FailedExiting" - exit 1 - fi - fi -} - -# Function to convert size to human readable format -declare -a SpaceUnits=( B KB MB GB TB PB ) -declare -i SpaceUnitsIndex -declare -i SpaceInt -setspaceunits () { - SpaceUnitsIndex=0 - (( Size *= 100 )) # add two decimal places - while [ "$Size" -ge 102400 ] ; do - let Size="$Size"/1024 - (( SpaceUnitsIndex++ )) - done - SpaceString="$Size" - StringLength=${#SpaceString} - let Intlength="$StringLength - 2" - StringLeft=${SpaceString:0:$Intlength} - StringRight=${SpaceString:$Intlength} - SpaceString="$StringLeft.$StringRight${SpaceUnits[$SpaceUnitsIndex]}" - if [ "$Size" -gt 100 ] ; then - SpaceString="$SpaceString"s - else - SpaceString="$SpaceString " - fi - printf '%s' "$SpaceString" -} - -# Exit if not root. -if [[ "$(id -u)" != "0" ]] ; then - MustBeRoot=$(eval_gettext "Must be root to run \$ThisScript") - ShowMsgExit "$MustBeRoot" - exit 0 -fi - -InstallPackageIfFileMissing /usr/bin/dcfldd dcfldd -InstallPackageIfFileMissing /usr/bin/dialog cdialog -InstallPackageIfFileMissing /usr/bin/udisks udisks -InstallPackageIfFileMissing /etc/cron.daily/mlocate.cron mlocate - -if="" -if [[ $# -eq 1 && -r "$1" ]] ; then - if="$1" -fi - -runmlocate="no" -if [ -z "$if" ] ; then - if [ ! -s /var/lib/mlocate/mlocate.db ] ; then - runmlocate="yes" - else - dbdatetext=$(stat /var/lib/mlocate/mlocate.db|grep Modify) - dbdate="${dbdatetext#* }" # strip upto and including first space - dbdatesecondssince1970=$(date -u -d "$dbdate" "+%s") - currentsecondscince1970=$(date -u "+%s") - dbageseconds=$(( $currentsecondscince1970 - $dbdatesecondssince1970 )) - if (("$dbageseconds" > "86400")) ; then # 86400 seconds is one day - runmlocate="yes" - else - mlocateAsk=$(eval_gettext "mlocate.db is \${dbageseconds} seconds old (it's used to locate iso files), would you like it updated?") - $dialogcmd --backtitle "$TitleString" \ - --title "copyiso2usb" \ - --yesno "$mlocateAsk" "$MaxLines" "$MaxColumns" - Selected=$? - if (( ! $Selected)) ; then - runmlocate="yes" - fi - fi - fi -fi - - -if [[ "$runmlocate" == "yes" ]] ; then - DisplayText="${Waitmlocate}" - RunCommand "/etc/cron.daily/mlocate.cron" -fi - -IFS=$'\n' -isolist=($(locate -eiq .iso|grep -i iso$)) -unset IFS -if [ "${#isolist[@]}" == 0 ] ; then - ShowMsgExit "$NoISOFound" - exit 2 -fi - -for i in "${isolist[@]}" ; do - isolistshow="${i// /_}" # Show spaces in file names as underscores - MenuText="$MenuText $menuitem ${isolistshow}" - (( menuitem++ )) -done - -if [[ $# -eq 1 && -r "$1" ]] ; then - if="$1" -else - DisplayText="$SelectISO" - DisplayMenu - Selected=$(<$FileNameTemp) - rm -f "$FileNameTemp" - if [[ "${Selected}" == "" ]] ; then - exit 3 # Cancel selected - fi - if="${isolist[$Selected]}" -fi - -shopt -s nullglob -usbdrives=($(listusbdrives)) - -if [ "${#usbdrives[@]}" == 0 ] ; then - ShowMsgExit "$NoUSBDrives" - exit 4 -fi - -menuitem=0 -MenuText="" - -for dev in "${usbdrives[@]}" ; do - IFS=$'\n' - udisksinfo=($(udisks --show-info /dev/$dev |grep -e size -e label -e vendor -e model -e serial)) - unset IFS - Size=${udisksinfo[0]##*: } - read -rd '' Size <<< "$Size" - usbsize[$menuitem]="$Size" - SizeString=$(setspaceunits) - Label=${udisksinfo[2]##*: } - Vendor=${udisksinfo[3]##*: } - Model=${udisksinfo[4]##*: } - Serial=${udisksinfo[5]##*: } - if [[ "${Label}" == "" ]] ; then - udisksinfo=($(udisks --show-info /dev/${dev}1 |grep -e label)) - Label=${udisksinfo[0]##*:} - fi - Mountpoint="" - read mntdev Mountpoint rest<<<"$(grep ^/dev/$dev /proc/mounts)" - read -rd '' SizeString <<< "$SizeString" # Remove leading/trailing spaces - SizeString="${SizeString// /_}" # Translate any embedded spaces to underscores - Label="" - read -rd '' Label <<< "$Label" - if [[ "${Label}" == "" ]] ; then - if [ -e "/dev/${dev}1" ] ; then - IFS=$'\n' - udisksinfo=($(udisks --show-info /dev/${dev}1 |grep -m 1 label)) - unset IFS - Label=${udisksinfo[0]##*:} - fi - fi - read -rd '' Label <<< "$Label" - Label="${Label// /_}" - read -rd '' Vendor <<< "$Vendor" - Vendor="${Vendor// /_}" - read -rd '' Model <<< "$Model" - Model="${Model// /_}" - read -rd '' Serial <<< "$Serial" - Serial="${Serial// /_}" - read -rd '' Mountpoint <<< "$Mountpoint" - Mountpoint="${Mountpoint// /_}" - if [[ ! "${Mountpoint}" == "" ]] ; then - Mountpoint="---MOUNTED_at_${Mountpoint}" - fi - MenuText="$MenuText $menuitem ${dev}.${SizeString}.${Label}.${Vendor}.${Model}.${Serial}${Mountpoint}" - (( menuitem++ )) -done -DisplayText="$SelectUSBDrive" -DisplayMenu -Selected=$(<$FileNameTemp) -rm -f "$FileNameTemp" - -if [[ "${Selected}" == "" ]] ; then - exit 5 # Cancel selected -fi - -of="${usbdrives[$Selected]}" -ofsize="${usbsize[$Selected]}" -ddcmd="dcfldd sizeprobe=if statusinterval=5 if='""$if""' of=/dev/$of bs=1M" - -read label IsoSize rest<<<"$(stat $if|grep Size)" -if (( $IsoSize > $ofsize )) ; then - TooBig=$(eval_gettext "ISO size is \$IsoSize bytes. Selected USB stick only has room for \$ofsize bytes. Copy cancelled. Exiting.") - ShowMsgExit "$TooBig" - exit 7 -fi - -ConfirmRun=$(eval_gettext "About to run\${Newline}\${ddcmd}\${Newline}Please select yes to confirm, or no to cancel.\${Newline}NOTE: When it runs, please wait for 'rc=0' before continuing.") -$dialogcmd --backtitle "$TitleString" \ - --title "copyiso2usb" \ - --yesno "$ConfirmRun" "$MaxLines" "$MaxColumns" -Selected=$? - -if (($Selected)) ; then - ShowMsgExit "$CopyCancelled" - exit 7 -fi - -DisplayText="$WaitCopy" -RunCommand "${ddcmd} 2>&1" -exit 0 - diff --git a/usr/share/locale/id/LC_MESSAGES/copyiso2usb.mo b/usr/share/locale/id/LC_MESSAGES/copyiso2usb.mo Binary files differdeleted file mode 100644 index de28b8b..0000000 --- a/usr/share/locale/id/LC_MESSAGES/copyiso2usb.mo +++ /dev/null diff --git a/usr/share/locale/uk/LC_MESSAGES/copyiso2usb.mo b/usr/share/locale/uk/LC_MESSAGES/copyiso2usb.mo Binary files differdeleted file mode 100644 index 453ad81..0000000 --- a/usr/share/locale/uk/LC_MESSAGES/copyiso2usb.mo +++ /dev/null diff --git a/usr/share/man/id/man1/copyiso2usb.1 b/usr/share/man/id/man1/copyiso2usb.1 deleted file mode 100644 index ca3de01..0000000 --- a/usr/share/man/id/man1/copyiso2usb.1 +++ /dev/null @@ -1,21 +0,0 @@ -.\"******************************************************************* -.\" -.\" This file was generated with po4a. Translate the source file. -.\" -.\"******************************************************************* -.TH COPYISO2USB 1 "September 2013" "Utilitas Mageia" "Perintah Pengguna" -.SH NAMA -copyiso2usb \- salin file iso ke drive usb -.SH SINOPSIS -\fBcopyiso2usb\fP <file> -.SH DESKRIPSI -.\" Add any additional description here -.PP -Jika file tidak ditentukan, opsi untuk mengupdate basis data lokasi akan -diberikan, dan jika diminta, basis data akan diupdate setelah daftar file -iso yang tersedia ditampilkan untuk dipilih. - -Daftar drive usb yang tersedia ditampilkan untuk dipilih. Setelah dipilih -dan dikonfirmasi, file yang ditentukan atau file iso yang dipilih akan -disalin ke drive usb. - diff --git a/usr/share/man/uk/man1/copyiso2usb.1 b/usr/share/man/uk/man1/copyiso2usb.1 deleted file mode 100644 index d52575d..0000000 --- a/usr/share/man/uk/man1/copyiso2usb.1 +++ /dev/null @@ -1,21 +0,0 @@ -.\"******************************************************************* -.\" -.\" This file was generated with po4a. Translate the source file. -.\" -.\"******************************************************************* -.TH COPYISO2USB 1 "вересень 2013 року" "Утиліти Mageia" "Команди користувача" -.SH НАЗВА -copyiso2usb — програма для запису файлів ISO на диски USB -.SH "КОРОТКИЙ ОПИС" -\fBcopyiso2usb\fP <файл> -.SH ОПИС -.\" Add any additional description here -.PP -Якщо файл не вказано, користувач зможе наказати системі оновити бази даних -файлів locate. Якщо буде вибрано такий варіант дій, буде оновлено базу даних -і показано список усіх доступних файлів ISO, з якого користувач зможе -вибрати потрібний файл. - -Програмою буде показано список усіх доступних дисків USB. Щойно буде вибрано -потрібний диск і підтверджено дію, вказаний файл буде записано на диск USB. - |