coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: suggestion: /etc/dd.conf


From: Leslie S Satenstein
Subject: Re: suggestion: /etc/dd.conf
Date: Wed, 29 Apr 2020 13:51:01 +0000 (UTC)

Just put the dd command into a scriptThat is what I do.
I created a simple bash script that makes your actions easy and 
semi-automaticIt is attached.  Licensed GPL2 GPL3 (FREE TO DO WITH IT WHAT YOU 
WANT)

Regards 
 Leslie
 Leslie Satenstein
Montréal Québec, Canada

#!/bin/bash 
# Author Leslie Satenstein 2019-01-12  
# mydd1.sh Licensed as gpl3  
# Yours to modify to your hearts content. 
# Not responsbile for your goofups 
#   
echo -e "\n$(basename $0 ) version 0.9 12Mar2019" 
MOUNT_INFO=$(mount -l | grep iso9660 ) 
DEVICE=$(echo $MOUNT_INFO | cut - -d' ' -f1 ) 
SIZE=${#DEVICE} 
if [ $# = 1 ] 
then 
        if [[ $SIZE < "5" ]]; 
        then 
           echo "ISO $1 not mounted"  
           exit 1 
        fi 
fi 
ISOFILE=$1 
rc=0 
rc=0 
if [[ $# -ne 1 ]]; 
then 
   echo 
   echo  "Use to create Bootable USB Flashdrive. Use as: $(basename $0)  
path_to_iso/isofile.iso" 
   echo "$(basename $0) One parameter: path_to_isofile/distribution.iso" 
   echo " You must be certain that the /dev/sd? is for a flashdrive]" 
   echo 
   exit 1 
fi 
if [ ! -e $ISOFILE ];then echo "$ISOFILE does not exist!" ; exit 1; fi 
# -- iso file should end in dot iso -- 
if [[ $ISOFILE != *.iso ]];then echo "\"${ISOFILE}\" is not an *.iso file" >&2 
   exit 1 
fi 
bs='bs=8M' 
echo "sudo dd of=$DEVICE if=$1  $bs status=progress oflag=direct,sync" 
yn="x" 
   echo -e "\n\t\tThis ISO: $1" 
   echo -e "\n\t\tTo overwrite this USB/flashdrive information?\n\t\t" 
   sudo blkid $DEVICE* 
   echo "" 
while [[ $yn == "x" ]] 
do 
   echo -e "continue? y/n " 
   read yn 
   if [[ "x$yn" != "x" ]]; 
   then 
     if [ "$yn" == "n" ];then exit 0; fi 
     if [ "$yn" == "N" ];then exit 0; fi 
     if [ "$yn" == "y" ]; then break; fi 
     if [ "$yn" == "Y" ]; then break; fi 
     if [ "$yn" == "YES" || "$yn" == "yes" ]; 
     then 
          yn="Y" 
          break; 
     fi 
     if [ "$yn" == "NO" || "$yn" == "no" ]; then exit 0; fi 
   fi 
   yn="x" 
done 
 
sudo dd if=$1  of=$DEVICE  $bs status=progress oflag=direct,sync 
sync 
echo "eject $DEVICE" 



 

    On Tuesday, April 28, 2020, 10:26:35 p.m. GMT-4, carl hansen 
<address@hidden> wrote:  
 
 On Tue, Apr 28, 2020 at 6:08 AM turgut kalfaoğlu <address@hidden> wrote:
>
> I would like to suggest and in fact volunteer to create a conf file
> option to 'dd'.
>
> It has dozens of hard to remember options, and there are some that I
> would like to use all the time.
>
> For example, I am currently doing:
>
> $  sudo dd if=CentOS-6.10-x86_64-LiveDVD.iso of=/dev/sdc bs=4096 conv=fsync
>
> right now, and I have to lookup the conv=fsync option every time I want
> to write to a USB drive.
>
>
> Any thoughts?
>
> Thanks,
>
>    -turgut

suggestion, just create a file and make it executable that includes
all your options
echo  sudo dd if=CentOS-6.10-x86_64-LiveDVD.iso of=/dev/sdc bs=4096
conv=fsync> $HOME/bin/ddforCent
put $HOME/bin in your $PATH
you could make several versions, with differing options
ddforSomesituation, ddforforsomeothersitutation etc


The last thing the world needs is another conf file, with its documentation
  

Attachment: mydd1.sh
Description: application/shellscript


reply via email to

[Prev in Thread] Current Thread [Next in Thread]