Welcome to mirror list, hosted at ThFree Co, Russian Federation.

reflash « script « hakchi « mod_hakchi « mods - github.com/ClusterM/hakchi2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: a7beaefb4e6abb5d802ac01f071e062aa67018b6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
local firmware="$(find -type f -name "*.hsqs" | sort | head -n 1)"
if [ -f "$firmware" ]; then
  umount_base
  umount "$mountpoint"

  cryptsetup close root-crypt
  cryptsetup open /dev/nandb root-crypt --type plain --cipher aes-xts-plain --key-file /key-file

  dd if=/dev/zero of=/dev/mapper/root-crypt bs=512 "seek=$(($(stat -c%s "$firmware")/512))"
  dd "if=$firmware" of=/dev/mapper/root-crypt bs=512

  cryptsetup close root-crypt
  cryptsetup open /dev/nandb root-crypt --readonly --type plain --cipher aes-xts-plain --key-file /key-file

  mount -o ro,noatime /dev/mapper/root-crypt "$mountpoint"

  local tmk="$(pwd)/mkfs.txz"
  if [ -f "$tmk"]; then
    cd / && tar xJf "$tmk"
    mount_bind "$mountpoint/lib" "/lib"
#    /sbin/mkfs.ext4 -L data -m 0 /dev/nandc
    mkfs.ext2 -L data -m 0 /dev/nandc
    umount "/lib"
  fi

  mount_base
fi