Commit 85e8cf16 authored by fuyanbin's avatar fuyanbin
Browse files

hugep-all.zip放到本地,打包前修改vendor.yaml,再更新zip文件

parent 8f53df8e
#!/bin/bash #!/bin/bash
set -e set -e
img="$1" #!/bin/bash
zippath="$2" usage() {
echo "Usage: $0 -V | --vendor <vendor id>
-t | --type <pipe type>
-i | --image <image file>
--chroot-type <pack type>
--orgcode <organization code>
--channelid <channel id>
--help"
exit 1
}
build_dir=$(mktemp -d ./tmp.XXXXX) VENDOR=""
systemfile="$build_dir/system.PARTITION" PIPE_TYPE="small"
systemfile_ext4="$build_dir/system.PARTITION.ext4" CHROOT_TYPE="androidrom"
DEPLOY="elf"
aml_image_v2_packer -d "$img" "./$build_dir" ORGCODE=""
if file "$systemfile" | grep "Android sparse image" CHANNELID=""
then IMAGE_FILE="/opt/image-base/armbian.img"
simg2img "$systemfile" "$systemfile_ext4"
loopdev=$(sudo losetup -P -f --show "$systemfile_ext4")
else
loopdev=$(sudo losetup -P -f --show "$systemfile")
fi
mkdir "$build_dir/system"
sudo mount "$loopdev" "$build_dir/system"
sudo touch "$build_dir/system/.androidrom"
if [[ -n "$zippath" ]]
then
sudo wget "$zippath" -O "$build_dir/system/bin/hugep-all.zip"
else
sudo rm -f "$build_dir/system/hugep-all.zip"
fi
sudo find ./services/ -type f -name "*.rc" -exec install -t "$build_dir"/system/etc/init/ {} \; export PATH=${PATH}:$(pwd)/tools/
sudo find ./services/ -type f ! -name "*.rc" -exec install -m 0777 -t "$build_dir"/system/bin/ {} \; PARSED_ARUGMENTS=$(getopt -a -n "$0" -o V:t:i: --long help,vendor:,type:,image:,chroot-type:,orgcode:,channelid:, -- "$@")
for file in $(find ./services/ -type f ! -name "*.rc") eval set -- "${PARSED_ARUGMENTS}"
while :
do do
sudo chcon u:object_r:drmserver_exec:s0 "$build_dir/system/bin/$(basename "$file")" case "$1" in
-V | --vendor) VENDOR="$2"; shift 2 ;;
-t | --type) PIPE_TYPE="$2"; shift 2 ;;
-i | --image) IMAGE_FILE="$2"; shift 2 ;;
--chroot-type) CHROOT_TYPE="$2"; shift 2 ;;
--orgcode) ORGCODE="$2"; shift 2;;
--channelid) CHANNELID="$2"; shift 2;;
--help) usage ;;
--) shift; break;;
*) usage ;;
esac
done done
sudo umount "$loopdev" build_dir=$(mktemp -d ./tmp.XXXXX)
sudo losetup -d "$loopdev"
rm -rf "$build_dir/system" build_image() {
sync img="$1"
systemfile="$build_dir/system.PARTITION"
if [[ -f "$systemfile_ext4" ]] systemfile_ext4="$build_dir/system.PARTITION.ext4"
then
rm -f "$systemfile" aml_image_v2_packer -d "$img" "./$build_dir"
img2simg "$systemfile_ext4" "$systemfile" if file "$systemfile" | grep "Android sparse image"
rm -f "$systemfile_ext4" then
fi simg2img "$systemfile" "$systemfile_ext4"
aml_image_v2_packer -r "./$build_dir/image.cfg" "$build_dir" "$(basename "$img")" loopdev=$(sudo losetup -P -f --show "$systemfile_ext4")
sudo rm -rf "./$build_dir/" else
loopdev=$(sudo losetup -P -f --show "$systemfile")
fi
mkdir "$build_dir/system"
sudo mount "$loopdev" "$build_dir/system"
sudo touch "$build_dir/system/.androidrom"
sudo rm -f "$build_dir/system/hugep-all.zip"
sudo cp -f "$build_dir/hugep-all.zip" "$build_dir/system/hugep-all.zip"
sudo find ./services/ -type f -name "*.rc" -exec install -t "$build_dir"/system/etc/init/ {} \;
sudo find ./services/ -type f ! -name "*.rc" -exec install -m 0777 -t "$build_dir"/system/bin/ {} \;
for file in $(find ./services/ -type f ! -name "*.rc")
do
sudo chcon u:object_r:drmserver_exec:s0 "$build_dir/system/bin/$(basename "$file")"
done
sudo umount "$loopdev"
sudo losetup -d "$loopdev"
rm -rf "$build_dir/system"
sync
if [[ -f "$systemfile_ext4" ]]
then
rm -f "$systemfile"
img2simg "$systemfile_ext4" "$systemfile"
rm -f "$systemfile_ext4"
fi
aml_image_v2_packer -r "./$build_dir/image.cfg" "$build_dir" "$(basename "$img")"
sudo rm -rf "./$build_dir/"
}
genarae_vendor_confg() {
local yaml_file_src
local yaml_file
yaml_file="$build_dir"/vendor.yaml
yaml_file_src="$build_dir"/vendor.yaml.src
cp vendor.yaml.src "$yaml_file_src"
sed -i'' "s#$__VENDOR__/$VENDOR/g" "$yaml_file_src"
sed -i'' "s#$__ORGCODE__/$ORGCODE/g" "$yaml_file_src"
sed -i'' "s#$__CHROOT_TYPE__/$CHROOT_TYPE/g" "$yaml_file_src"
sed -i'' "s#$__DEPLOY__/$DEPLOY/g" "$yaml_file_src"
aio -m enc -i "$yaml_file_src" -o "$yaml_file"
}
update_hugepall_zipfile() {
local yaml_file
local hugep_zip_file
local hugep_zip_file_origin
yaml_file="$build_dir"/vendor.yaml
hugep_zip_file="$build_dir/hugep-all.zip"
hugep_zip_file_origin="./services/hugep-all.zip"
cp "$hugep_zip_file_origin" "$hugep_zip_file"
zip -u -j "$yaml_file" "$hugep_zip_file"
}
export PATH="$PATH":"$(pwd)"/tools/
build_image "$IMAGE_FILE"
File added
File added
info:
vendor: __VENDOR__
pipe: small
organization: __ORGCODE__
mode: arm32
chroottype: __CHROOT_TYPE__
deploy: __DEPLOY__
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment