Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
initscripts: update data partition on boot
If venus-data.{tar.gz,tgz,zip} is found on removable storage when booting, unpack it into /data.
- Loading branch information
Showing
2 changed files
with
32 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#! /bin/sh | ||
|
||
ARCHIVE_NAME=venus-data | ||
ARCHIVE_SUF="tar.gz tgz zip" | ||
|
||
unpack() { | ||
archive=$1 | ||
dest=$2 | ||
|
||
case $archive in | ||
*.tar.gz|*.tgz) | ||
tar xzf "$archive" -C "$dest" | ||
;; | ||
*.zip) | ||
unzip -d "$dest" "$archive" | ||
;; | ||
esac | ||
} | ||
|
||
for dir in /media/*; do | ||
for suf in $ARCHIVE_SUF; do | ||
archive=$dir/$ARCHIVE_NAME.$suf | ||
if [ -f "$archive" ]; then | ||
echo "Updating /data with $archive" | ||
unpack "$archive" /data | ||
fi | ||
done | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
469760f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unpacking of venus-data.zip file fails on my system, while unpacking venus-data.tar.gz is successful
469760f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, thank you; good to know.
Most likely this just is what it is; and some zip formats might work while others don’t. And, tar.gz working is good enough.