updatepw.sh (756B)
1 #!/usr/bin/env zsh 2 3 for i in `find -name "*.xz"`; do 4 rm ${i}.sha 5 xz -d $i 6 done 7 8 for i in `find -name "*.img"`; do 9 loopdev=`sudo losetup -f --show ${i}` 10 mappdev=`sudo kpartx -va $loopdev | sed -E 's/.*(loop[0-9])p.*/\1/g' | head -1` 11 12 mappdev="/dev/mapper/${mappdev}" 13 rootpart="${mappdev}p2" 14 15 [[ -d "mountdir" ]] || mkdir mountdir 16 17 mount ${rootpart} mountdir 18 19 cat << EOF | sudo tee mountdir/changepw 20 #!/bin/sh 21 echo "root:devuan" | chpasswd 22 EOF 23 24 sudo cp /usr/bin/qemu-arm-static mountdir/usr/bin/qemu-arm-static 25 26 sudo chroot mountdir /changepw 27 sudo rm mountdir/changepw 28 sudo rm mountdir/usr/bin/qemu-arm-static 29 30 sudo umount ${rootpart} 31 32 sudo kpartx -dv ${loopdev} 33 sudo losetup -d ${loopdev} 34 35 xz -zv ${i} 36 sha256sum ${i}.xz > ${i}.xz.sha 37 done