Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changed from sfdisk to fdisk #822

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 24 additions & 3 deletions build.img
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,32 @@ do_img()
fi
if [ -z "$config_fstype_boot" ]; then
# echo "71680,+,83,," | sfdisk -u S -N1 -H 4 -S 16 -q $IMGNAME > /dev/null 2>&1
echo "$config_offset_root,+,83,," | sfdisk -u S -N1 -H 4 -S 16 -q $IMGNAME > /dev/null 2>&1
fdisk $IMGNAME <<EOF > /dev/null 2>&1
n
p
1
$config_offset_root

w
EOF
else
# echo "71680,+,83,," | sfdisk -u S -N2 -H 4 -S 16 -q $IMGNAME > /dev/null 2>&1
echo "2048,$((config_offset_root-2048)),b,*," | sfdisk -u S -N1 -H 4 -S 16 -q $IMGNAME > /dev/null 2>&1
echo "$config_offset_root,+,83,," | sfdisk -u S -N2 -H 4 -S 16 -q $IMGNAME > /dev/null 2>&1
fdisk $IMGNAME <<EOF > /dev/null 2>&1
n
p
1
2048
$((config_offset_root-1))
t
b
a
n
p
2


w
EOF
fi

[ -d /run ] || mkdir /run
Expand Down
12 changes: 11 additions & 1 deletion xbian-build-img/hooks.d/post-img.d/resize-part-btrfs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,17 @@ umount ./rootfs; sync
newpartsize=$(dmesg | grep -i "new size" | grep "/dev/mapper/${loopd}p${rootpart}\|/dev/dm" | tail -1 | awk '{print $NF}')
newpartsize=$((newpartsize/512+64))
kpartx -dv $IMGNAME
echo ",$newpartsize,,," | sfdisk -u S -N${rootpart} -H 4 -S 16 -q $IMGNAME > /dev/null 2>&1; sync
fdisk $IMGNAME <<EOF
d
$rootpart
n
p
2

$newpartsize
w
EOF
sync

newimgsize=$((newpartsize+141312))
dd if=$IMGNAME of=$IMGNAME.new bs=512 count=$newimgsize
Expand Down
12 changes: 11 additions & 1 deletion xbian-build-img/hooks.d/post-img.d/resize-part-ext4
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,17 @@ newpartsize=$((config_img_size+20))
df -h | grep /working/
umount ./rootfs; sync
kpartx -dv $IMGNAME
echo ",$newpartsize,,," | sfdisk -u S -N2 -H 4 -S 16 -q $IMGNAME > /dev/null 2>&1; sync
fdisk $IMGNAME <<EOF >/dev/null 2>&1
d
2
n
p
2

$newpartsize
w
EOF
sync

newimgsize=$((newpartsize+141312))
dd if=$IMGNAME of=$IMGNAME.new bs=512 count=$newimgsize
Expand Down