aljungorg / imagizor Goto Github PK
View Code? Open in Web Editor NEWWIP! Apprenticeship project! A linux bash script used to write software images to a sdcard or pen drive
License: The Unlicense
WIP! Apprenticeship project! A linux bash script used to write software images to a sdcard or pen drive
License: The Unlicense
It would be nice if the tool could write an image to a usb-stick, too!
dd does not seem to write the image data in sync mode to the device. This results in ridiculous high transfer speeds shown to the user. The sdcard I used in this test does not offer write speeds above 60MB/s.
`
Copy process
Copy the File on the SD-Card
[sudo] Passwort für root:
8176000000 bytes (8,2 GB, 7,6 GiB) copied, 68,1704 s, **120 MB/**s
`
please validate that needed tools are installed at program start. If a tool is not installed, list the name of the tool and terminate the program.
it would be nice if the tool could validate the downloaded file. This could be done by passing an additional URL which points to a checksum file.
Please add a section in the README that tells contributors how to contribute.
Are there special rules? Formatters to use? Code style? Tests? etc.
Sample console log, download cancelled using STRG+C
`0 [patrick@linux-lmem ~/workspace_git/imagizor (master)]$ ./imagizor.sh -d http://download.opensuse.org/distribution/leap/42.3/iso/openSUSE-Leap-42.3-DVD-x86_64.iso
download process and verifikation
Download the Software
--2017-11-20 10:11:44-- http://download.opensuse.org/distribution/leap/42.3/iso/openSUSE-Leap-42.3-DVD-x86_64.iso
Auflösen des Hostnamen »download.opensuse.org (download.opensuse.org)«... 2001:67c:2178:8::13, 195.135.221.134
Verbindungsaufbau zu download.opensuse.org (download.opensuse.org)|2001:67c:2178:8::13|:80... verbunden.
HTTP-Anforderung gesendet, warte auf Antwort... 302 Found
Platz: http://mirror.clarkson.edu/opensuse/distribution/leap/42.3/iso/openSUSE-Leap-42.3-DVD-x86_64.iso[folge]
--2017-11-20 10:11:44-- http://mirror.clarkson.edu/opensuse/distribution/leap/42.3/iso/openSUSE-Leap-42.3-DVD-x86_64.iso
Auflösen des Hostnamen »mirror.clarkson.edu (mirror.clarkson.edu)«... 128.153.145.19
Verbindungsaufbau zu mirror.clarkson.edu (mirror.clarkson.edu)|128.153.145.19|:80... verbunden.
HTTP-Anforderung gesendet, warte auf Antwort... 200 OK
Länge: 4639948800 (4,3G) [application/octet-stream]
In »»openSUSE-Leap-42.3-DVD-x86_64.iso«« speichern.
3% [====> ] 157.600.080 9,48MB/s ETA 7m 57s ^C
130 [p@linux~/workspace_git/imagizor (master)]$ ls
images imagizor imagizor.sh LICENSE openSUSE-Leap-42.3-DVD-x86_64.iso README.md
`
./imagizor.sh -c lite-server-sw2-sdcard-image-8192-v2-754.img SD-Card Do you want to copy on the SD-Card or on the USB-Stick? SD-Card,USB-Stick [S,U]:
Tell the user about the source of the problem => faulty image file
Give advice what can be done to solve the problem => new download etc.
Please enter a check value methodik
mdsum, sha256, I dont have a checkvalue [m,s,a]:s
Now enter the Check value number:asdfads
ERROR: Hash values are not the same
Ples try it again
Verifikation Unsuccessfully
I think it is a good idea to have some test scripts that can be run after bigger changes to see if everything is still working fine.
By the way...
this would also give us the chance to let the jenkins server run the tests when it detects changes in the git repo automatically.
For example a zip file
allows changes
declare RED_BEG="\\033[31m"
variable becomes a constant, subsequent writes to it will result in errors
declare -r RED_BEG="\\033[31m"
./imagizor.sh Call: ./image_to_device.sh [-d, --download, -g, --gunzip] [Downloadlink, File to unpack] ./image_to_device.sh -g --gunzip File to unpack ./image_to_device.sh -d --download Downloadlink ./image_to_device.sh -c --copy File to copy Example: ./imagizor.sh -d http://download.opensuse.org/distribution/leap/42.3/iso/openSUSE-Leap-42.3-DVD-x86_64.iso.sha256
It would be nice if one could provide the program with all needed information at program start to avoid inquires during runtime. This would give the chance to run the programm unattended.
It would be nice if the program would terminate and display an error, if the target device (USB-Stick, SD-CARD, whatever) is removed during the copy process.
example: image.img.bz2
Help_trace => help_trace
Some locations require username and password to access the download file.
``Copy process
Copy the File on the SD-Card
dd: konnte '/dev/mmcblk0' nicht öffnen: Das Dateisystem ist nur lesbar
imagizor only accepts imagefiles that are located in the same directory where the script is located.
The verfication process copies back the whole target device. We only need to read as many bytes as we wrote to the target device.
`______________________________________________________________________
Copy process
Copy the File on the SD-Card
24+1 Datensätze ein
24+1 Datensätze aus
194891212 bytes (195 MB, 186 MiB) copied, 4,2006 s, 46,4 MB/s
Verifying
Copy the File from the SD-Card back into an File
13797000000 bytes (14 GB, 13 GiB) copied, 204,006 s, 67,6 MB/s `
#26 must be finished first!
To keep the code compact and easy to extend, create an array tools and iterate over the array to check whether the tool is installed or not.
example
#>>==========================================================================>>
# DESCRIPTION: copies system update to specified installation directory
#
# PARAMETER 1: system update destination dir
# RETURN: -
# USAGE: install_system_update "$DEST_MNT_DATA/update"
#
# AUTHOR: PW
# REVIEWER(S): -
#<<==========================================================================<<
install_system_update()
{
local -r SYS_UPDATE_FILE="update_check.sh"
local -r SYS_UPDATE_SRC_DIR="$BOARD_CTRL_SRC/system_update"
local -r SYS_UPDATE_DEST_DIR="$1"
chmod ugo+x $SYS_UPDATE_SRC_DIR/*
cp -v $SYS_UPDATE_SRC_DIR/* $SYS_UPDATE_DEST_DIR
}
Now enter the Check value number: 195baca6c5f3b7f3ad4d7984a7f7bd5c4a37be2eb67e58b65d07ac3a2b599e83
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.