120 lines
3.5 KiB
Bash
120 lines
3.5 KiB
Bash
#!/usr/bin/env zsh
|
|
|
|
conf_print_resolvconf() {
|
|
fn conf_print_resolvconf
|
|
|
|
cat <<-EOF
|
|
nameserver 1.1.1.1
|
|
nameserver 1.0.0.1
|
|
EOF
|
|
}
|
|
# conf_print_resolvconf | sudo tee $strapdir/etc/resolv.conf >/dev/null
|
|
|
|
|
|
conf_print_sourceslist() {
|
|
fn conf_print_sourceslist "(override)"
|
|
req=(mirror release section)
|
|
ckreq || return 1
|
|
|
|
# this also happens in debootstrap but doesn't handle tor
|
|
# this change should be made there.
|
|
case ${mirror} in
|
|
https://*)
|
|
base_packages+="apt-transport-https ca-certificates"
|
|
;;
|
|
tor+http://*)
|
|
base_packages+="apt-transport-tor ca-certificates"
|
|
esac
|
|
|
|
cat <<-EOF
|
|
# Package repositories
|
|
deb ${mirror} ${release} ${section}
|
|
deb ${mirror} ${release}-updates ${section}
|
|
deb ${mirror} ${release}-security ${section}
|
|
deb ${mirror} ${release}-backports ${section}
|
|
|
|
# Source repositories
|
|
#deb-src ${mirror} ${release} ${section}
|
|
#deb-src ${mirror} ${release}-updates ${section}
|
|
#deb-src ${mirror} ${release}-security ${section}
|
|
#deb-src ${mirror} ${release}-backports ${section}
|
|
EOF
|
|
}
|
|
# conf_print_sourceslist | sudo tee $strapdir/etc/apt/sources.list >/dev/null
|
|
|
|
|
|
conf_print_fstab() {
|
|
fn conf_print_fstab "(override)"
|
|
[[ -n "$livesdk_version" ]] && return
|
|
cat <<-EOF
|
|
#<file system> <mount point> <type> <options> <dump> <pass>
|
|
EOF
|
|
}
|
|
# conf_print_fstab | sudo tee $strapdir/etc/fstab >/dev/null
|
|
|
|
|
|
conf_print_UUID_fstab() {
|
|
fn conf_print_UUID_fstab
|
|
req=(strapdir bootfs rootfs bootuuid rootuuid espuuid)
|
|
ckreq || return 1
|
|
|
|
cat <<-EOF
|
|
UUID=${rootuuid} / ${rootfs} defaults 0 1
|
|
UUID=${bootuuid} /boot ${bootfs} defaults 0 1
|
|
EOF
|
|
|
|
cat <<-EOF | sudo tee -a "$strapdir/etc/fstab" >/dev/null
|
|
UUID=${espuuid} /boot/grub ${espfs} defaults 0 1
|
|
EOF
|
|
}
|
|
# conf_print_UUID_fstab | sudo tee $strapdir/etc/fstab >/dev/null
|
|
|
|
|
|
conf_print_PARTUUID_fstab() {
|
|
fn conf_print_UUID_fstab
|
|
req=(strapdir bootfs rootfs bootpart_partuuid rootpart_partuuid esppart_partuuid)
|
|
ckreq || return 1
|
|
|
|
cat <<-EOF
|
|
PARTUUID=${rootpart_partuuid} / ${rootfs} defaults 0 1
|
|
PARTUUID=${bootpart_partuuid} /boot ${bootfs} defaults 0 1
|
|
EOF
|
|
|
|
if [[ "${uefi}" ]]; then
|
|
cat <<-EOF | sudo tee -a "$strapdir/etc/fstab" >/dev/null
|
|
PARTUUID=${esppart_partuuid} /boot/efi ${espfs} defaults 0 1
|
|
EOF
|
|
else
|
|
cat <<-EOF | sudo tee -a "$strapdir/etc/fstab" >/dev/null
|
|
PARTUUID=${esppart_partuuid} /boot/grub ${espfs} defaults 0 1
|
|
EOF
|
|
fi
|
|
}
|
|
# conf_print_PARTUUID_fstab | sudo tee $strapdir/etc/fstab >/dev/null
|
|
|
|
conf_print_flash_script() {
|
|
fn conf_print_flash_script
|
|
req=(image_name board uboot_branch uboot_image_format)
|
|
|
|
cat <<-EOF
|
|
#!/usr/bin/env bash
|
|
set -x
|
|
|
|
IMAGE=\${1:-\${PWD}/${image_name}.img.xz}
|
|
LOADER=\${2:-\${PWD}/u-boot/idbloader_${board}-${uboot_branch}.img}
|
|
UBOOT=\${3:-\${PWD}/u-boot/u-boot_${board}-${uboot_branch}.itb}
|
|
DEVICE=\${4:-/dev/sdb}
|
|
|
|
echo "flashing image..."
|
|
xzcat \${IMAGE} | sudo dd of=\${DEVICE} bs=2M status=progress
|
|
|
|
echo "flashing uboot..."
|
|
dd if=\${LOADER} of=\${DEVICE} seek=64 status=progress conv=notrunc,fsync
|
|
dd if=\${UBOOT} of=\${DEVICE} seek=16384 status=progress conv=notrunc,fsync
|
|
|
|
sgdisk --move-second-header \${DEVICE}
|
|
partprobe \${DEVICE}
|
|
EOF
|
|
}
|
|
# conf_print_flash_script | sudo tee $R/dist/flash-rockpro64_${gitbranch}.sh >/dev/null
|