add rsync and packing to imaging
This commit is contained in:
parent
fbf3c68b5a
commit
57bda192d5
|
|
@ -81,6 +81,48 @@ image_partition_raw_gpt() {
|
||||||
sudo mkfs.ext4 -L rootfs $rootpart
|
sudo mkfs.ext4 -L rootfs $rootpart
|
||||||
}
|
}
|
||||||
|
|
||||||
|
image_package_dist() {
|
||||||
|
fn image_package_dist
|
||||||
|
req=(mappdevice loopdevice image_name strapdir workdir)
|
||||||
|
ckreq || return 1
|
||||||
|
|
||||||
|
notice "packaging image for dist"
|
||||||
|
|
||||||
|
act "rechecking filesystem"
|
||||||
|
sudo e2fsck -f ${mappdevice}p2
|
||||||
|
sudo resize2fs ${mappdevice}p2
|
||||||
|
|
||||||
|
sleep 2
|
||||||
|
|
||||||
|
# TODO: decide how to check gpt
|
||||||
|
# [[ $gpt = 0 ]] || {
|
||||||
|
# sudo cgpt repair $loopdevice
|
||||||
|
# sleep 2
|
||||||
|
# }
|
||||||
|
|
||||||
|
sudo kpartx -dv $loopdevice || { die "kpartx failed to remove $loopdevice"; zerr }
|
||||||
|
sudo losetup -d $loopdevice || { die "losetup failed to remove $loopdevice"; zerr }
|
||||||
|
|
||||||
|
notice "compressing image with xz"
|
||||||
|
silly
|
||||||
|
pushd $workdir
|
||||||
|
xz -zv ${image_name}.img
|
||||||
|
|
||||||
|
notice "generating sha256 for ${image_name}.img.xz"
|
||||||
|
sha256sum ${image_name}.img.xz > ${image_name}.img.xz.sha
|
||||||
|
|
||||||
|
mkdir -p $R/dist
|
||||||
|
mv -v ${image_name}.img.xz $R/dist/
|
||||||
|
mv -v ${image_name}.img.xz.sha $R/dist/
|
||||||
|
popd
|
||||||
|
|
||||||
|
[[ $DEBUG = 1 ]] || { sudo rm -r $workdir }
|
||||||
|
|
||||||
|
notice "finished packing $image_name"
|
||||||
|
act "find it in $R/dist/"
|
||||||
|
act "thanks for being patient!"
|
||||||
|
}
|
||||||
|
|
||||||
image_raw_mount() {
|
image_raw_mount() {
|
||||||
fn image_raw_mount
|
fn image_raw_mount
|
||||||
req=(workdir bootpart rootpart)
|
req=(workdir bootpart rootpart)
|
||||||
|
|
@ -90,3 +132,12 @@ image_raw_mount() {
|
||||||
sudo mount $bootpart $workdir/boot && act "mounted boot partition" || zerr
|
sudo mount $bootpart $workdir/boot && act "mounted boot partition" || zerr
|
||||||
sudo mount $rootpart $workdir/root && act "mounted root partition" || zerr
|
sudo mount $rootpart $workdir/root && act "mounted root partition" || zerr
|
||||||
}
|
}
|
||||||
|
|
||||||
|
image_raw_umount() {
|
||||||
|
fn image_raw_umount
|
||||||
|
req=(workdir bootpart rootpart)
|
||||||
|
ckreq || return 1
|
||||||
|
|
||||||
|
sudo umount $workdir/boot && act "unmounted boot partition" || zerr
|
||||||
|
sudo umount $workdir/root && act "unmounted root partition" || zerr
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,36 @@
|
||||||
|
#!/usr/bin/env zsh
|
||||||
|
# Copyright (c) 2016 Dyne.org Foundation
|
||||||
|
# libdevuansdk is maintained by Ivan J. <parazyd@dyne.org>
|
||||||
|
#
|
||||||
|
# This file is part of libdevuansdk
|
||||||
|
#
|
||||||
|
# This source code is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This software is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this source code. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
## ilporcodio
|
||||||
|
|
||||||
|
rsync_to_raw_image() {
|
||||||
|
fn rsync_to_raw_image
|
||||||
|
req=(workdir strapdir bootpart rootpart)
|
||||||
|
|
||||||
|
notice "rsyncing strapdir to raw image..."
|
||||||
|
image_raw_mount
|
||||||
|
|
||||||
|
silly
|
||||||
|
pushd $strapdir
|
||||||
|
sudo rsync -HPavz -q --exclude={./boot} ./* $workdir/root
|
||||||
|
sudo rsync -HPavz -q ./boot/* $workdir/boot
|
||||||
|
popd
|
||||||
|
|
||||||
|
image_raw_umount
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue