basic system imaging
This commit is contained in:
parent
6d349011ca
commit
cd4d4616db
38
dotfiles-old/scripts/grammy/image.sh
Executable file
38
dotfiles-old/scripts/grammy/image.sh
Executable file
@ -0,0 +1,38 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
argv0="$0"
|
||||
argv1="$1"
|
||||
argv2="$2"
|
||||
|
||||
FILE_NAME="image.img.gz"
|
||||
COMPACT="gzip -c"
|
||||
EXTRACT="gzip -cd"
|
||||
|
||||
usage() {
|
||||
printf "Usage: $argv0 {save,deploy} [device]
|
||||
|
||||
Examples:
|
||||
$argv0 save /dev/sda1 # images installation at /dev/sda1
|
||||
$argv0 deploy /dev/sda # deploys saved image to /dev/sda
|
||||
|
||||
In-program constants (edit this script to change them):
|
||||
\$FILE_NAME - where to save/read the image
|
||||
\$COMPACT - command to compact the image (such as \"gzip -c\" to
|
||||
compress with gzip)
|
||||
\$EXTRACT - command to extract the image (such as \"gzip -cd\" to
|
||||
extract gzip)\n"
|
||||
exit 1
|
||||
}
|
||||
|
||||
[ -n "$argv2" ] || usage
|
||||
|
||||
set -x
|
||||
|
||||
case "$argv1" in
|
||||
(save) $COMPACT <"$argv2" >"$FILE_NAME" ;;
|
||||
(deploy) $EXTRACT <"$FILE_NAME" >"$argv2" ;;
|
||||
esac
|
||||
|
||||
exit 0
|
Loading…
Reference in New Issue
Block a user