Skip to content
Permalink
Browse files

scripts/functions.sh: sync with openwrt, 2019.09

  • Loading branch information...
The-BB committed Sep 20, 2019
1 parent 874230c commit e9ac73f5d47f40644530ab6f742ba199bff73d1a
Showing with 26 additions and 0 deletions.
  1. +26 −0 scripts/functions.sh
@@ -0,0 +1,26 @@
#!/bin/sh


get_magic_word() {
dd if=$1 bs=4 count=1 2>/dev/null | od -A n -N 4 -t x1 | tr -d ' '
}

get_fs_type() {
local magic_word="$(get_magic_word "$1")"

case "$magic_word" in
"3118"*)
echo "ubifs"
;;
"68737173")
echo "squashfs"
;;
*)
echo "unknown"
;;
esac
}

round_up() {
echo "$(((($1 + ($2 - 1))/ $2) * $2))"
}

0 comments on commit e9ac73f

Please sign in to comment.
You can’t perform that action at this time.