mirror of
https://github.com/armbian/build
synced 2025-09-24 19:47:06 +07:00
run shellfmt on all of lib
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
install_deb_chroot()
|
||||
{
|
||||
install_deb_chroot() {
|
||||
|
||||
local package=$1
|
||||
local variant=$2
|
||||
|
||||
@@ -40,14 +40,14 @@ add_apt_sources() {
|
||||
|
||||
display_alert "Adding APT Source ${new_apt_source}"
|
||||
|
||||
if [[ "${new_apt_source}" == ppa* ]] ; then
|
||||
if [[ "${new_apt_source}" == ppa* ]]; then
|
||||
# ppa with software-common-properties
|
||||
run_on_sdcard "add-apt-repository -y -n \"${new_apt_source}\""
|
||||
# add list with apt-add
|
||||
# -y -> Assumes yes to all queries
|
||||
# -n -> Do not update package cache after adding
|
||||
if [[ -f "${apt_source_gpg_filepath}" ]]; then
|
||||
display_alert "Adding GPG Key ${apt_source_gpg_filepath}"
|
||||
display_alert "Adding GPG Key ${apt_source_gpg_filepath}"
|
||||
cp "${apt_source_gpg_filepath}" "${SDCARD}/tmp/${apt_source_gpg_filename}"
|
||||
run_on_sdcard "apt-key add \"/tmp/${apt_source_gpg_filename}\""
|
||||
echo "APT Key returned : $?"
|
||||
@@ -57,7 +57,7 @@ add_apt_sources() {
|
||||
echo "${new_apt_source}" > "${SDCARD}/etc/apt/sources.list.d/${apt_source_filename}"
|
||||
if [[ -f "${apt_source_gpg_filepath}" ]]; then
|
||||
display_alert "Adding GPG Key ${apt_source_gpg_filepath}"
|
||||
# local apt_source_gpg_filename="$(basename ${apt_source_gpg_filepath})"
|
||||
# local apt_source_gpg_filename="$(basename ${apt_source_gpg_filepath})"
|
||||
mkdir -p "${SDCARD}"/usr/share/keyrings/
|
||||
cp "${apt_source_gpg_filepath}" "${SDCARD}"/usr/share/keyrings/
|
||||
fi
|
||||
|
||||
@@ -2,9 +2,8 @@
|
||||
# Create kernel boot logo from packages/blobs/splash/logo.png and packages/blobs/splash/spinner.gif (animated)
|
||||
# and place to the file /lib/firmware/bootsplash
|
||||
#--------------------------------------------------------------------------------------------------------------------------------
|
||||
function boot_logo ()
|
||||
{
|
||||
display_alert "Building kernel splash logo" "$RELEASE" "info"
|
||||
function boot_logo() {
|
||||
display_alert "Building kernel splash logo" "$RELEASE" "info"
|
||||
|
||||
LOGO=${SRC}/packages/blobs/splash/logo.png
|
||||
LOGO_WIDTH=$(identify $LOGO | cut -d " " -f 3 | cut -d x -f 1)
|
||||
@@ -12,105 +11,105 @@ display_alert "Building kernel splash logo" "$RELEASE" "info"
|
||||
THROBBER=${SRC}/packages/blobs/splash/spinner.gif
|
||||
THROBBER_WIDTH=$(identify $THROBBER | head -1 | cut -d " " -f 3 | cut -d x -f 1)
|
||||
THROBBER_HEIGHT=$(identify $THROBBER | head -1 | cut -d " " -f 3 | cut -d x -f 2)
|
||||
convert -alpha remove -background "#000000" $LOGO "${SDCARD}"/tmp/logo.rgb
|
||||
convert -alpha remove -background "#000000" $LOGO "${SDCARD}"/tmp/logo.rgb
|
||||
convert -alpha remove -background "#000000" $THROBBER "${SDCARD}"/tmp/throbber%02d.rgb
|
||||
$PKG_PREFIX${SRC}/packages/blobs/splash/bootsplash-packer \
|
||||
--bg_red 0x00 \
|
||||
--bg_green 0x00 \
|
||||
--bg_blue 0x00 \
|
||||
--frame_ms 48 \
|
||||
--picture \
|
||||
--pic_width $LOGO_WIDTH \
|
||||
--pic_height $LOGO_HEIGHT \
|
||||
--pic_position 0 \
|
||||
--blob "${SDCARD}"/tmp/logo.rgb \
|
||||
--picture \
|
||||
--pic_width $THROBBER_WIDTH \
|
||||
--pic_height $THROBBER_HEIGHT \
|
||||
--pic_position 0x05 \
|
||||
--pic_position_offset 200 \
|
||||
--pic_anim_type 1 \
|
||||
--pic_anim_loop 0 \
|
||||
--blob "${SDCARD}"/tmp/throbber00.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber01.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber02.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber03.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber04.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber05.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber06.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber07.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber08.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber09.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber10.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber11.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber12.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber13.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber14.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber15.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber16.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber17.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber18.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber19.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber20.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber21.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber22.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber23.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber24.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber25.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber26.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber27.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber28.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber29.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber30.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber31.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber32.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber33.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber34.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber35.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber36.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber37.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber38.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber39.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber40.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber41.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber42.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber43.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber44.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber45.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber46.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber47.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber48.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber49.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber50.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber51.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber52.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber53.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber54.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber55.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber56.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber57.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber58.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber59.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber60.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber61.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber62.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber63.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber64.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber65.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber66.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber67.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber68.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber69.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber70.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber71.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber72.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber73.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber74.rgb \
|
||||
"${SDCARD}"/lib/firmware/bootsplash.armbian >/dev/null 2>&1
|
||||
--bg_red 0x00 \
|
||||
--bg_green 0x00 \
|
||||
--bg_blue 0x00 \
|
||||
--frame_ms 48 \
|
||||
--picture \
|
||||
--pic_width $LOGO_WIDTH \
|
||||
--pic_height $LOGO_HEIGHT \
|
||||
--pic_position 0 \
|
||||
--blob "${SDCARD}"/tmp/logo.rgb \
|
||||
--picture \
|
||||
--pic_width $THROBBER_WIDTH \
|
||||
--pic_height $THROBBER_HEIGHT \
|
||||
--pic_position 0x05 \
|
||||
--pic_position_offset 200 \
|
||||
--pic_anim_type 1 \
|
||||
--pic_anim_loop 0 \
|
||||
--blob "${SDCARD}"/tmp/throbber00.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber01.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber02.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber03.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber04.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber05.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber06.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber07.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber08.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber09.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber10.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber11.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber12.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber13.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber14.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber15.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber16.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber17.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber18.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber19.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber20.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber21.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber22.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber23.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber24.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber25.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber26.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber27.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber28.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber29.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber30.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber31.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber32.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber33.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber34.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber35.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber36.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber37.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber38.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber39.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber40.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber41.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber42.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber43.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber44.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber45.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber46.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber47.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber48.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber49.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber50.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber51.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber52.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber53.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber54.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber55.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber56.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber57.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber58.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber59.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber60.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber61.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber62.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber63.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber64.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber65.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber66.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber67.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber68.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber69.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber70.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber71.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber72.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber73.rgb \
|
||||
--blob "${SDCARD}"/tmp/throbber74.rgb \
|
||||
"${SDCARD}"/lib/firmware/bootsplash.armbian > /dev/null 2>&1
|
||||
if [[ $BOOT_LOGO == yes || $BOOT_LOGO == desktop && $BUILD_DESKTOP == yes ]]; then
|
||||
[[ -f "${SDCARD}"/boot/armbianEnv.txt ]] && grep -q '^bootlogo' "${SDCARD}"/boot/armbianEnv.txt && \
|
||||
sed -i 's/^bootlogo.*/bootlogo=true/' "${SDCARD}"/boot/armbianEnv.txt || echo 'bootlogo=true' >> "${SDCARD}"/boot/armbianEnv.txt
|
||||
[[ -f "${SDCARD}"/boot/boot.ini ]] && sed -i 's/^setenv bootlogo.*/setenv bootlogo "true"/' "${SDCARD}"/boot/boot.ini
|
||||
[[ -f "${SDCARD}"/boot/armbianEnv.txt ]] && grep -q '^bootlogo' "${SDCARD}"/boot/armbianEnv.txt &&
|
||||
sed -i 's/^bootlogo.*/bootlogo=true/' "${SDCARD}"/boot/armbianEnv.txt || echo 'bootlogo=true' >> "${SDCARD}"/boot/armbianEnv.txt
|
||||
[[ -f "${SDCARD}"/boot/boot.ini ]] && sed -i 's/^setenv bootlogo.*/setenv bootlogo "true"/' "${SDCARD}"/boot/boot.ini
|
||||
fi
|
||||
# enable additional services
|
||||
chroot "${SDCARD}" /bin/bash -c "systemctl --no-reload enable bootsplash-ask-password-console.path >/dev/null 2>&1"
|
||||
|
||||
@@ -2,8 +2,7 @@
|
||||
#
|
||||
# returns md5 hash for current package list and rootfs cache version
|
||||
|
||||
get_package_list_hash()
|
||||
{
|
||||
get_package_list_hash() {
|
||||
local package_arr exclude_arr
|
||||
local list_content
|
||||
read -ra package_arr <<< "${DEBOOTSTRAP_LIST} ${PACKAGE_LIST}"
|
||||
@@ -17,8 +16,7 @@ get_package_list_hash()
|
||||
# get_rootfs_cache_list <cache_type> <packages_hash>
|
||||
#
|
||||
# return a list of versions of all avaiable cache from remote and local.
|
||||
get_rootfs_cache_list()
|
||||
{
|
||||
get_rootfs_cache_list() {
|
||||
local cache_type=$1
|
||||
local packages_hash=$2
|
||||
|
||||
@@ -28,10 +26,10 @@ get_rootfs_cache_list()
|
||||
# || curl --silent --fail -L https://cache.armbian.com/rootfs/list
|
||||
curl --silent --fail -L https://cache.armbian.com/rootfs/list
|
||||
|
||||
find ${SRC}/cache/rootfs/ -mtime -7 -name "${ARCH}-${RELEASE}-${cache_type}-${packages_hash}-*.tar.zst" \
|
||||
| sed -e 's#^.*/##' \
|
||||
| sed -e 's#\..*$##' \
|
||||
| awk -F'-' '{print $5}'
|
||||
find ${SRC}/cache/rootfs/ -mtime -7 -name "${ARCH}-${RELEASE}-${cache_type}-${packages_hash}-*.tar.zst" |
|
||||
sed -e 's#^.*/##' |
|
||||
sed -e 's#\..*$##' |
|
||||
awk -F'-' '{print $5}'
|
||||
} | sort | uniq
|
||||
}
|
||||
|
||||
@@ -39,8 +37,7 @@ get_rootfs_cache_list()
|
||||
#
|
||||
# unpacks cached rootfs for $RELEASE or creates one
|
||||
#
|
||||
create_rootfs_cache()
|
||||
{
|
||||
create_rootfs_cache() {
|
||||
local packages_hash=$(get_package_list_hash)
|
||||
local packages_hash=${packages_hash:0:8}
|
||||
|
||||
@@ -51,7 +48,7 @@ create_rootfs_cache()
|
||||
|
||||
# seek last cache, proceed to previous otherwise build it
|
||||
local cache_list
|
||||
readarray -t cache_list <<<"$(get_rootfs_cache_list "$cache_type" "$packages_hash" | sort -r)"
|
||||
readarray -t cache_list <<< "$(get_rootfs_cache_list "$cache_type" "$packages_hash" | sort -r)"
|
||||
for ROOTFSCACHE_VERSION in "${cache_list[@]}"; do
|
||||
|
||||
local cache_name=${ARCH}-${RELEASE}-${cache_type}-${packages_hash}-${ROOTFSCACHE_VERSION}.tar.zst
|
||||
@@ -64,8 +61,8 @@ create_rootfs_cache()
|
||||
# if aria2 file exists download didn't succeeded
|
||||
if [[ ! -f $cache_fname || -f ${cache_fname}.aria2 ]]; then
|
||||
display_alert "Downloading from servers"
|
||||
download_and_verify "rootfs" "$cache_name" \
|
||||
|| continue
|
||||
download_and_verify "rootfs" "$cache_name" ||
|
||||
continue
|
||||
fi
|
||||
|
||||
[[ -f $cache_fname && ! -f ${cache_fname}.aria2 ]] && break
|
||||
@@ -74,7 +71,7 @@ create_rootfs_cache()
|
||||
# if aria2 file exists download didn't succeeded
|
||||
if [[ "$ROOT_FS_CREATE_ONLY" != "yes" && -f $cache_fname && ! -f $cache_fname.aria2 ]]; then
|
||||
|
||||
local date_diff=$(( ($(date +%s) - $(stat -c %Y $cache_fname)) / 86400 ))
|
||||
local date_diff=$((($(date +%s) - $(stat -c %Y $cache_fname)) / 86400))
|
||||
display_alert "Extracting $cache_name" "$date_diff days old" "info"
|
||||
pv -p -b -r -c -N "[ .... ] $cache_name" "$cache_fname" | zstdmt -dc | tar xp --xattrs -C $SDCARD/
|
||||
[[ $? -ne 0 ]] && rm $cache_fname && exit_with_error "Cache $cache_fname is corrupted and was deleted. Restart."
|
||||
@@ -301,7 +298,7 @@ create_rootfs_cache()
|
||||
rm -rf $SDCARD
|
||||
# remove exit trap
|
||||
trap - INT TERM EXIT
|
||||
exit
|
||||
exit
|
||||
fi
|
||||
|
||||
mount_chroot "$SDCARD"
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
customize_image()
|
||||
{
|
||||
customize_image() {
|
||||
|
||||
# for users that need to prepare files at host
|
||||
[[ -f $USERPATCHES_PATH/customize-image-host.sh ]] && source "$USERPATCHES_PATH"/customize-image-host.sh
|
||||
@@ -18,7 +17,7 @@ PRE_CUSTOMIZE_IMAGE
|
||||
display_alert "Calling image customization script" "customize-image.sh" "info"
|
||||
chroot "${SDCARD}" /bin/bash -c "/tmp/customize-image.sh $RELEASE $LINUXFAMILY $BOARD $BUILD_DESKTOP $ARCH"
|
||||
CUSTOMIZE_IMAGE_RC=$?
|
||||
umount -i "${SDCARD}"/tmp/overlay >/dev/null 2>&1
|
||||
umount -i "${SDCARD}"/tmp/overlay > /dev/null 2>&1
|
||||
mountpoint -q "${SDCARD}"/tmp/overlay || rm -r "${SDCARD}"/tmp/overlay
|
||||
if [[ $CUSTOMIZE_IMAGE_RC != 0 ]]; then
|
||||
exit_with_error "customize-image.sh exited with error (rc: $CUSTOMIZE_IMAGE_RC)"
|
||||
|
||||
@@ -1,16 +1,15 @@
|
||||
install_common()
|
||||
{
|
||||
install_common() {
|
||||
display_alert "Applying common tweaks" "" "info"
|
||||
|
||||
# install rootfs encryption related packages separate to not break packages cache
|
||||
if [[ $CRYPTROOT_ENABLE == yes ]]; then
|
||||
display_alert "Installing rootfs encryption related packages" "cryptsetup" "info"
|
||||
chroot "${SDCARD}" /bin/bash -c "apt-get -y -qq --no-install-recommends install cryptsetup" \
|
||||
>> "${DEST}"/${LOG_SUBPATH}/install.log 2>&1
|
||||
>> "${DEST}"/${LOG_SUBPATH}/install.log 2>&1
|
||||
if [[ $CRYPTROOT_SSH_UNLOCK == yes ]]; then
|
||||
display_alert "Installing rootfs encryption related packages" "dropbear-initramfs" "info"
|
||||
chroot "${SDCARD}" /bin/bash -c "apt-get -y -qq --no-install-recommends install dropbear-initramfs cryptsetup-initramfs" \
|
||||
>> "${DEST}"/${LOG_SUBPATH}/install.log 2>&1
|
||||
>> "${DEST}"/${LOG_SUBPATH}/install.log 2>&1
|
||||
fi
|
||||
|
||||
fi
|
||||
@@ -25,9 +24,9 @@ install_common()
|
||||
if [[ $CRYPTROOT_ENABLE == yes && $CRYPTROOT_SSH_UNLOCK == yes ]]; then
|
||||
# Set the port of the dropbear ssh daemon in the initramfs to a different one if configured
|
||||
# this avoids the typical 'host key changed warning' - `WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!`
|
||||
[[ -f "${SDCARD}"/etc/dropbear-initramfs/config ]] && \
|
||||
sed -i 's/^#DROPBEAR_OPTIONS=/DROPBEAR_OPTIONS="-p '"${CRYPTROOT_SSH_UNLOCK_PORT}"'"/' \
|
||||
"${SDCARD}"/etc/dropbear-initramfs/config
|
||||
[[ -f "${SDCARD}"/etc/dropbear-initramfs/config ]] &&
|
||||
sed -i 's/^#DROPBEAR_OPTIONS=/DROPBEAR_OPTIONS="-p '"${CRYPTROOT_SSH_UNLOCK_PORT}"'"/' \
|
||||
"${SDCARD}"/etc/dropbear-initramfs/config
|
||||
|
||||
# setup dropbear authorized_keys, either provided by userpatches or generated
|
||||
if [[ -f $USERPATCHES_PATH/dropbear_authorized_keys ]]; then
|
||||
@@ -37,7 +36,7 @@ install_common()
|
||||
# this key should be changed by the user on first login
|
||||
display_alert "Generating a new SSH key pair for dropbear (initramfs)" "" ""
|
||||
ssh-keygen -t ecdsa -f "${SDCARD}"/etc/dropbear-initramfs/id_ecdsa \
|
||||
-N '' -O force-command=cryptroot-unlock -C 'AUTOGENERATED_BY_ARMBIAN_BUILD' >> "${DEST}"/${LOG_SUBPATH}/install.log 2>&1
|
||||
-N '' -O force-command=cryptroot-unlock -C 'AUTOGENERATED_BY_ARMBIAN_BUILD' >> "${DEST}"/${LOG_SUBPATH}/install.log 2>&1
|
||||
|
||||
# /usr/share/initramfs-tools/hooks/dropbear will automatically add 'id_ecdsa.pub' to authorized_keys file
|
||||
# during mkinitramfs of update-initramfs
|
||||
@@ -46,7 +45,7 @@ install_common()
|
||||
# copy dropbear ssh key to image output dir for convenience
|
||||
cp "${SDCARD}"/etc/dropbear-initramfs/id_ecdsa "${DEST}/images/${CRYPTROOT_SSH_UNLOCK_KEY_NAME}"
|
||||
display_alert "SSH private key for dropbear (initramfs) has been copied to:" \
|
||||
"$DEST/images/$CRYPTROOT_SSH_UNLOCK_KEY_NAME" "info"
|
||||
"$DEST/images/$CRYPTROOT_SSH_UNLOCK_KEY_NAME" "info"
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -67,11 +66,11 @@ install_common()
|
||||
fi
|
||||
|
||||
# configure MIN / MAX speed for cpufrequtils
|
||||
cat <<-EOF > "${SDCARD}"/etc/default/cpufrequtils
|
||||
ENABLE=true
|
||||
MIN_SPEED=$CPUMIN
|
||||
MAX_SPEED=$CPUMAX
|
||||
GOVERNOR=$GOVERNOR
|
||||
cat <<- EOF > "${SDCARD}"/etc/default/cpufrequtils
|
||||
ENABLE=true
|
||||
MIN_SPEED=$CPUMIN
|
||||
MAX_SPEED=$CPUMAX
|
||||
GOVERNOR=$GOVERNOR
|
||||
EOF
|
||||
|
||||
# remove default interfaces file if present
|
||||
@@ -113,12 +112,12 @@ install_common()
|
||||
# enable automated login to console(s)
|
||||
mkdir -p "${SDCARD}"/etc/systemd/system/getty@.service.d/
|
||||
mkdir -p "${SDCARD}"/etc/systemd/system/serial-getty@.service.d/
|
||||
cat <<-EOF > "${SDCARD}"/etc/systemd/system/serial-getty@.service.d/override.conf
|
||||
[Service]
|
||||
ExecStartPre=/bin/sh -c 'exec /bin/sleep 10'
|
||||
ExecStart=
|
||||
ExecStart=-/sbin/agetty --noissue --autologin root %I \$TERM
|
||||
Type=idle
|
||||
cat <<- EOF > "${SDCARD}"/etc/systemd/system/serial-getty@.service.d/override.conf
|
||||
[Service]
|
||||
ExecStartPre=/bin/sh -c 'exec /bin/sleep 10'
|
||||
ExecStart=
|
||||
ExecStart=-/sbin/agetty --noissue --autologin root %I \$TERM
|
||||
Type=idle
|
||||
EOF
|
||||
cp "${SDCARD}"/etc/systemd/system/serial-getty@.service.d/override.conf "${SDCARD}"/etc/systemd/system/getty@.service.d/override.conf
|
||||
|
||||
@@ -158,10 +157,10 @@ install_common()
|
||||
else
|
||||
bootpart_prefix=/boot/
|
||||
fi
|
||||
cat <<-EOF > "$SDCARD/boot/extlinux/extlinux.conf"
|
||||
label ${VENDOR}
|
||||
kernel ${bootpart_prefix}$NAME_KERNEL
|
||||
initrd ${bootpart_prefix}$NAME_INITRD
|
||||
cat <<- EOF > "$SDCARD/boot/extlinux/extlinux.conf"
|
||||
label ${VENDOR}
|
||||
kernel ${bootpart_prefix}$NAME_KERNEL
|
||||
initrd ${bootpart_prefix}$NAME_INITRD
|
||||
EOF
|
||||
if [[ -n $BOOT_FDT_FILE ]]; then
|
||||
if [[ $BOOT_FDT_FILE != "none" ]]; then
|
||||
@@ -199,13 +198,13 @@ install_common()
|
||||
fi
|
||||
fi
|
||||
|
||||
[[ -n $OVERLAY_PREFIX && -f "${SDCARD}"/boot/armbianEnv.txt ]] && \
|
||||
[[ -n $OVERLAY_PREFIX && -f "${SDCARD}"/boot/armbianEnv.txt ]] &&
|
||||
echo "overlay_prefix=$OVERLAY_PREFIX" >> "${SDCARD}"/boot/armbianEnv.txt
|
||||
|
||||
[[ -n $DEFAULT_OVERLAYS && -f "${SDCARD}"/boot/armbianEnv.txt ]] && \
|
||||
[[ -n $DEFAULT_OVERLAYS && -f "${SDCARD}"/boot/armbianEnv.txt ]] &&
|
||||
echo "overlays=${DEFAULT_OVERLAYS//,/ }" >> "${SDCARD}"/boot/armbianEnv.txt
|
||||
|
||||
[[ -n $BOOT_FDT_FILE && -f "${SDCARD}"/boot/armbianEnv.txt ]] && \
|
||||
[[ -n $BOOT_FDT_FILE && -f "${SDCARD}"/boot/armbianEnv.txt ]] &&
|
||||
echo "fdtfile=${BOOT_FDT_FILE}" >> "${SDCARD}/boot/armbianEnv.txt"
|
||||
|
||||
fi
|
||||
@@ -216,14 +215,14 @@ install_common()
|
||||
echo "${HOST}" > "${SDCARD}"/etc/hostname
|
||||
|
||||
# set hostname in hosts file
|
||||
cat <<-EOF > "${SDCARD}"/etc/hosts
|
||||
127.0.0.1 localhost
|
||||
127.0.1.1 $HOST
|
||||
::1 localhost $HOST ip6-localhost ip6-loopback
|
||||
fe00::0 ip6-localnet
|
||||
ff00::0 ip6-mcastprefix
|
||||
ff02::1 ip6-allnodes
|
||||
ff02::2 ip6-allrouters
|
||||
cat <<- EOF > "${SDCARD}"/etc/hosts
|
||||
127.0.0.1 localhost
|
||||
127.0.1.1 $HOST
|
||||
::1 localhost $HOST ip6-localhost ip6-loopback
|
||||
fe00::0 ip6-localnet
|
||||
ff00::0 ip6-mcastprefix
|
||||
ff02::1 ip6-allnodes
|
||||
ff02::2 ip6-allrouters
|
||||
EOF
|
||||
|
||||
cd $SRC
|
||||
@@ -250,7 +249,10 @@ install_common()
|
||||
# install board packages
|
||||
if [[ -n ${PACKAGE_LIST_BOARD} ]]; then
|
||||
display_alert "Installing PACKAGE_LIST_BOARD packages" "${PACKAGE_LIST_BOARD}"
|
||||
chroot "${SDCARD}" /bin/bash -c "DEBIAN_FRONTEND=noninteractive apt-get ${APT_EXTRA_DIST_PARAMS} -yqq --no-install-recommends install $PACKAGE_LIST_BOARD" >> "${DEST}"/${LOG_SUBPATH}/install.log || { display_alert "Failed to install PACKAGE_LIST_BOARD" "${PACKAGE_LIST_BOARD}" "err"; exit 2; }
|
||||
chroot "${SDCARD}" /bin/bash -c "DEBIAN_FRONTEND=noninteractive apt-get ${APT_EXTRA_DIST_PARAMS} -yqq --no-install-recommends install $PACKAGE_LIST_BOARD" >> "${DEST}"/${LOG_SUBPATH}/install.log || {
|
||||
display_alert "Failed to install PACKAGE_LIST_BOARD" "${PACKAGE_LIST_BOARD}" "err"
|
||||
exit 2
|
||||
}
|
||||
fi
|
||||
|
||||
# remove family packages
|
||||
@@ -279,7 +281,7 @@ install_common()
|
||||
fi
|
||||
}
|
||||
|
||||
call_extension_method "pre_install_kernel_debs" << 'PRE_INSTALL_KERNEL_DEBS'
|
||||
call_extension_method "pre_install_kernel_debs" << 'PRE_INSTALL_KERNEL_DEBS'
|
||||
*called before installing the Armbian-built kernel deb packages*
|
||||
It is not too late to `unset KERNELSOURCE` here and avoid kernel install.
|
||||
PRE_INSTALL_KERNEL_DEBS
|
||||
@@ -427,18 +429,18 @@ FAMILY_TWEAKS
|
||||
chroot "${SDCARD}" /bin/bash -c "systemctl --no-reload enable armbian-led-state.service >/dev/null 2>&1"
|
||||
|
||||
# copy "first run automated config, optional user configured"
|
||||
cp "${SRC}"/packages/bsp/armbian_first_run.txt.template "${SDCARD}"/boot/armbian_first_run.txt.template
|
||||
cp "${SRC}"/packages/bsp/armbian_first_run.txt.template "${SDCARD}"/boot/armbian_first_run.txt.template
|
||||
|
||||
# switch to beta repository at this stage if building nightly images
|
||||
[[ $IMAGE_TYPE == nightly ]] && sed -i 's/apt/beta/' "${SDCARD}"/etc/apt/sources.list.d/armbian.list
|
||||
|
||||
# Cosmetic fix [FAILED] Failed to start Set console font and keymap at first boot
|
||||
[[ -f "${SDCARD}"/etc/console-setup/cached_setup_font.sh ]] \
|
||||
&& sed -i "s/^printf '.*/printf '\\\033\%\%G'/g" "${SDCARD}"/etc/console-setup/cached_setup_font.sh
|
||||
[[ -f "${SDCARD}"/etc/console-setup/cached_setup_terminal.sh ]] \
|
||||
&& sed -i "s/^printf '.*/printf '\\\033\%\%G'/g" "${SDCARD}"/etc/console-setup/cached_setup_terminal.sh
|
||||
[[ -f "${SDCARD}"/etc/console-setup/cached_setup_keyboard.sh ]] \
|
||||
&& sed -i "s/-u/-x'/g" "${SDCARD}"/etc/console-setup/cached_setup_keyboard.sh
|
||||
[[ -f "${SDCARD}"/etc/console-setup/cached_setup_font.sh ]] &&
|
||||
sed -i "s/^printf '.*/printf '\\\033\%\%G'/g" "${SDCARD}"/etc/console-setup/cached_setup_font.sh
|
||||
[[ -f "${SDCARD}"/etc/console-setup/cached_setup_terminal.sh ]] &&
|
||||
sed -i "s/^printf '.*/printf '\\\033\%\%G'/g" "${SDCARD}"/etc/console-setup/cached_setup_terminal.sh
|
||||
[[ -f "${SDCARD}"/etc/console-setup/cached_setup_keyboard.sh ]] &&
|
||||
sed -i "s/-u/-x'/g" "${SDCARD}"/etc/console-setup/cached_setup_keyboard.sh
|
||||
|
||||
# fix for https://bugs.launchpad.net/ubuntu/+source/blueman/+bug/1542723
|
||||
chroot "${SDCARD}" /bin/bash -c "chown root:messagebus /usr/lib/dbus-1.0/dbus-daemon-launch-helper"
|
||||
@@ -453,12 +455,12 @@ FAMILY_TWEAKS
|
||||
fi
|
||||
|
||||
# disable repeated messages due to xconsole not being installed.
|
||||
[[ -f "${SDCARD}"/etc/rsyslog.d/50-default.conf ]] && \
|
||||
sed '/daemon\.\*\;mail.*/,/xconsole/ s/.*/#&/' -i "${SDCARD}"/etc/rsyslog.d/50-default.conf
|
||||
[[ -f "${SDCARD}"/etc/rsyslog.d/50-default.conf ]] &&
|
||||
sed '/daemon\.\*\;mail.*/,/xconsole/ s/.*/#&/' -i "${SDCARD}"/etc/rsyslog.d/50-default.conf
|
||||
|
||||
# disable deprecated parameter
|
||||
[[ -f "${SDCARD}"/etc/rsyslog.conf ]] && \
|
||||
sed '/.*$KLogPermitNonKernelFacility.*/,// s/.*/#&/' -i "${SDCARD}"/etc/rsyslog.conf
|
||||
[[ -f "${SDCARD}"/etc/rsyslog.conf ]] &&
|
||||
sed '/.*$KLogPermitNonKernelFacility.*/,// s/.*/#&/' -i "${SDCARD}"/etc/rsyslog.conf
|
||||
|
||||
# enable getty on multiple serial consoles
|
||||
# and adjust the speed if it is defined and different than 115200
|
||||
@@ -466,29 +468,28 @@ FAMILY_TWEAKS
|
||||
# example: SERIALCON="ttyS0:15000000,ttyGS1"
|
||||
#
|
||||
ifs=$IFS
|
||||
for i in $(echo "${SERIALCON:-'ttyS0'}" | sed "s/,/ /g")
|
||||
do
|
||||
for i in $(echo "${SERIALCON:-'ttyS0'}" | sed "s/,/ /g"); do
|
||||
IFS=':' read -r -a array <<< "$i"
|
||||
[[ "${array[0]}" == "tty1" ]] && continue # Don't enable tty1 as serial console.
|
||||
display_alert "Enabling serial console" "${array[0]}" "info"
|
||||
# add serial console to secure tty list
|
||||
[ -z "$(grep -w '^${array[0]}' "${SDCARD}"/etc/securetty 2> /dev/null)" ] && \
|
||||
echo "${array[0]}" >> "${SDCARD}"/etc/securetty
|
||||
[ -z "$(grep -w '^${array[0]}' "${SDCARD}"/etc/securetty 2> /dev/null)" ] &&
|
||||
echo "${array[0]}" >> "${SDCARD}"/etc/securetty
|
||||
if [[ ${array[1]} != "115200" && -n ${array[1]} ]]; then
|
||||
# make a copy, fix speed and enable
|
||||
cp "${SDCARD}"/lib/systemd/system/serial-getty@.service \
|
||||
"${SDCARD}/lib/systemd/system/serial-getty@${array[0]}.service"
|
||||
"${SDCARD}/lib/systemd/system/serial-getty@${array[0]}.service"
|
||||
sed -i "s/--keep-baud 115200/--keep-baud ${array[1]},115200/" \
|
||||
"${SDCARD}/lib/systemd/system/serial-getty@${array[0]}.service"
|
||||
"${SDCARD}/lib/systemd/system/serial-getty@${array[0]}.service"
|
||||
fi
|
||||
chroot "${SDCARD}" /bin/bash -c "systemctl daemon-reload" >> "${DEST}"/${LOG_SUBPATH}/install.log 2>&1
|
||||
chroot "${SDCARD}" /bin/bash -c "systemctl --no-reload enable serial-getty@${array[0]}.service" \
|
||||
>> "${DEST}"/${LOG_SUBPATH}/install.log 2>&1
|
||||
>> "${DEST}"/${LOG_SUBPATH}/install.log 2>&1
|
||||
if [[ "${array[0]}" == "ttyGS0" && $LINUXFAMILY == sun8i && $BRANCH == default ]]; then
|
||||
mkdir -p "${SDCARD}"/etc/systemd/system/serial-getty@ttyGS0.service.d
|
||||
cat <<-EOF > "${SDCARD}"/etc/systemd/system/serial-getty@ttyGS0.service.d/10-switch-role.conf
|
||||
[Service]
|
||||
ExecStartPre=-/bin/sh -c "echo 2 > /sys/bus/platform/devices/sunxi_usb_udc/otg_role"
|
||||
cat <<- EOF > "${SDCARD}"/etc/systemd/system/serial-getty@ttyGS0.service.d/10-switch-role.conf
|
||||
[Service]
|
||||
ExecStartPre=-/bin/sh -c "echo 2 > /sys/bus/platform/devices/sunxi_usb_udc/otg_role"
|
||||
EOF
|
||||
fi
|
||||
done
|
||||
@@ -533,9 +534,9 @@ FAMILY_TWEAKS
|
||||
sed "s/\[main\]/\[main\]\ndns=default\nrc-manager=file/g" -i "${SDCARD}"/etc/NetworkManager/NetworkManager.conf
|
||||
if [[ -n $NM_IGNORE_DEVICES ]]; then
|
||||
mkdir -p "${SDCARD}"/etc/NetworkManager/conf.d/
|
||||
cat <<-EOF > "${SDCARD}"/etc/NetworkManager/conf.d/10-ignore-interfaces.conf
|
||||
[keyfile]
|
||||
unmanaged-devices=$NM_IGNORE_DEVICES
|
||||
cat <<- EOF > "${SDCARD}"/etc/NetworkManager/conf.d/10-ignore-interfaces.conf
|
||||
[keyfile]
|
||||
unmanaged-devices=$NM_IGNORE_DEVICES
|
||||
EOF
|
||||
fi
|
||||
|
||||
@@ -547,32 +548,32 @@ FAMILY_TWEAKS
|
||||
# enable services
|
||||
chroot "${SDCARD}" /bin/bash -c "systemctl enable systemd-networkd.service systemd-resolved.service" >> "${DEST}"/${LOG_SUBPATH}/install.log 2>&1
|
||||
|
||||
if [ -e /etc/systemd/timesyncd.conf ]; then
|
||||
if [ -e /etc/systemd/timesyncd.conf ]; then
|
||||
chroot "${SDCARD}" /bin/bash -c "systemctl enable systemd-timesyncd.service" >> "${DEST}"/${LOG_SUBPATH}/install.log 2>&1
|
||||
fi
|
||||
umask 022
|
||||
cat > "${SDCARD}"/etc/systemd/network/eth0.network <<- __EOF__
|
||||
[Match]
|
||||
Name=eth0
|
||||
[Match]
|
||||
Name=eth0
|
||||
|
||||
[Network]
|
||||
#MACAddress=
|
||||
DHCP=ipv4
|
||||
LinkLocalAddressing=ipv4
|
||||
#Address=192.168.1.100/24
|
||||
#Gateway=192.168.1.1
|
||||
#DNS=192.168.1.1
|
||||
#Domains=example.com
|
||||
NTP=0.pool.ntp.org 1.pool.ntp.org
|
||||
[Network]
|
||||
#MACAddress=
|
||||
DHCP=ipv4
|
||||
LinkLocalAddressing=ipv4
|
||||
#Address=192.168.1.100/24
|
||||
#Gateway=192.168.1.1
|
||||
#DNS=192.168.1.1
|
||||
#Domains=example.com
|
||||
NTP=0.pool.ntp.org 1.pool.ntp.org
|
||||
__EOF__
|
||||
|
||||
fi
|
||||
|
||||
# avahi daemon defaults if exists
|
||||
[[ -f "${SDCARD}"/usr/share/doc/avahi-daemon/examples/sftp-ssh.service ]] && \
|
||||
cp "${SDCARD}"/usr/share/doc/avahi-daemon/examples/sftp-ssh.service "${SDCARD}"/etc/avahi/services/
|
||||
[[ -f "${SDCARD}"/usr/share/doc/avahi-daemon/examples/ssh.service ]] && \
|
||||
cp "${SDCARD}"/usr/share/doc/avahi-daemon/examples/ssh.service "${SDCARD}"/etc/avahi/services/
|
||||
[[ -f "${SDCARD}"/usr/share/doc/avahi-daemon/examples/sftp-ssh.service ]] &&
|
||||
cp "${SDCARD}"/usr/share/doc/avahi-daemon/examples/sftp-ssh.service "${SDCARD}"/etc/avahi/services/
|
||||
[[ -f "${SDCARD}"/usr/share/doc/avahi-daemon/examples/ssh.service ]] &&
|
||||
cp "${SDCARD}"/usr/share/doc/avahi-daemon/examples/ssh.service "${SDCARD}"/etc/avahi/services/
|
||||
|
||||
# nsswitch settings for sane DNS behavior: remove resolve, assure libnss-myhostname support
|
||||
sed "s/hosts\:.*/hosts: files mymachines dns myhostname/g" -i "${SDCARD}"/etc/nsswitch.conf
|
||||
@@ -583,12 +584,12 @@ FAMILY_TWEAKS
|
||||
# Show logo
|
||||
if [[ $PLYMOUTH == yes ]]; then
|
||||
if [[ $BOOT_LOGO == yes || $BOOT_LOGO == desktop && $BUILD_DESKTOP == yes ]]; then
|
||||
[[ -f "${SDCARD}"/boot/armbianEnv.txt ]] && grep -q '^bootlogo' "${SDCARD}"/boot/armbianEnv.txt \
|
||||
&& sed -i 's/^bootlogo.*/bootlogo=true/' "${SDCARD}"/boot/armbianEnv.txt \
|
||||
|| echo 'bootlogo=true' >> "${SDCARD}"/boot/armbianEnv.txt
|
||||
[[ -f "${SDCARD}"/boot/armbianEnv.txt ]] && grep -q '^bootlogo' "${SDCARD}"/boot/armbianEnv.txt &&
|
||||
sed -i 's/^bootlogo.*/bootlogo=true/' "${SDCARD}"/boot/armbianEnv.txt ||
|
||||
echo 'bootlogo=true' >> "${SDCARD}"/boot/armbianEnv.txt
|
||||
|
||||
[[ -f "${SDCARD}"/boot/boot.ini ]] \
|
||||
&& sed -i 's/^setenv bootlogo.*/setenv bootlogo "true"/' "${SDCARD}"/boot/boot.ini
|
||||
[[ -f "${SDCARD}"/boot/boot.ini ]] &&
|
||||
sed -i 's/^setenv bootlogo.*/setenv bootlogo "true"/' "${SDCARD}"/boot/boot.ini
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -597,10 +598,9 @@ FAMILY_TWEAKS
|
||||
|
||||
}
|
||||
|
||||
install_rclocal()
|
||||
{
|
||||
install_rclocal() {
|
||||
|
||||
cat <<-EOF > "${SDCARD}"/etc/rc.local
|
||||
cat <<- EOF > "${SDCARD}"/etc/rc.local
|
||||
#!/bin/sh -e
|
||||
#
|
||||
# rc.local
|
||||
@@ -615,7 +615,7 @@ install_rclocal()
|
||||
# By default this script does nothing.
|
||||
|
||||
exit 0
|
||||
EOF
|
||||
chmod +x "${SDCARD}"/etc/rc.local
|
||||
EOF
|
||||
chmod +x "${SDCARD}"/etc/rc.local
|
||||
|
||||
}
|
||||
|
||||
@@ -1,18 +1,17 @@
|
||||
install_distribution_specific()
|
||||
{
|
||||
install_distribution_specific() {
|
||||
|
||||
display_alert "Applying distribution specific tweaks for" "$RELEASE" "info"
|
||||
|
||||
case $RELEASE in
|
||||
|
||||
sid)
|
||||
sid)
|
||||
|
||||
# (temporally) disable broken service
|
||||
chroot "${SDCARD}" /bin/bash -c "systemctl --no-reload disable smartmontools.service >/dev/null 2>&1"
|
||||
|
||||
;;
|
||||
;;
|
||||
|
||||
focal|jammy)
|
||||
focal | jammy)
|
||||
|
||||
# by using default lz4 initrd compression leads to corruption, go back to proven method
|
||||
sed -i "s/^COMPRESS=.*/COMPRESS=gzip/" "${SDCARD}"/etc/initramfs-tools/initramfs.conf
|
||||
@@ -42,7 +41,7 @@ install_distribution_specific()
|
||||
# disable conflicting services
|
||||
chroot "${SDCARD}" /bin/bash -c "systemctl --no-reload mask ondemand.service >/dev/null 2>&1"
|
||||
|
||||
;;
|
||||
;;
|
||||
|
||||
esac
|
||||
|
||||
@@ -58,10 +57,10 @@ install_distribution_specific()
|
||||
"update-locale --reset LANG=$DEST_LANG LANGUAGE=$DEST_LANG LC_ALL=$DEST_LANG"' ${OUTPUT_VERYSILENT:+' >/dev/null 2>/dev/null'}
|
||||
|
||||
# Basic Netplan config. Let NetworkManager/networkd manage all devices on this system
|
||||
[[ -d "${SDCARD}"/etc/netplan ]] && cat <<-EOF > "${SDCARD}"/etc/netplan/armbian-default.yaml
|
||||
network:
|
||||
version: 2
|
||||
renderer: $RENDERER
|
||||
[[ -d "${SDCARD}"/etc/netplan ]] && cat <<- EOF > "${SDCARD}"/etc/netplan/armbian-default.yaml
|
||||
network:
|
||||
version: 2
|
||||
renderer: $RENDERER
|
||||
EOF
|
||||
|
||||
# cleanup motd services and related files
|
||||
@@ -90,67 +89,66 @@ install_distribution_specific()
|
||||
# <release>: bullseye|focal|jammy|sid
|
||||
# <basedir>: path to root directory
|
||||
#
|
||||
create_sources_list()
|
||||
{
|
||||
create_sources_list() {
|
||||
local release=$1
|
||||
local basedir=$2
|
||||
[[ -z $basedir ]] && exit_with_error "No basedir passed to create_sources_list"
|
||||
|
||||
case $release in
|
||||
buster)
|
||||
cat <<-EOF > "${basedir}"/etc/apt/sources.list
|
||||
deb http://${DEBIAN_MIRROR} $release main contrib non-free
|
||||
#deb-src http://${DEBIAN_MIRROR} $release main contrib non-free
|
||||
buster)
|
||||
cat <<- EOF > "${basedir}"/etc/apt/sources.list
|
||||
deb http://${DEBIAN_MIRROR} $release main contrib non-free
|
||||
#deb-src http://${DEBIAN_MIRROR} $release main contrib non-free
|
||||
|
||||
deb http://${DEBIAN_MIRROR} ${release}-updates main contrib non-free
|
||||
#deb-src http://${DEBIAN_MIRROR} ${release}-updates main contrib non-free
|
||||
deb http://${DEBIAN_MIRROR} ${release}-updates main contrib non-free
|
||||
#deb-src http://${DEBIAN_MIRROR} ${release}-updates main contrib non-free
|
||||
|
||||
deb http://${DEBIAN_MIRROR} ${release}-backports main contrib non-free
|
||||
#deb-src http://${DEBIAN_MIRROR} ${release}-backports main contrib non-free
|
||||
deb http://${DEBIAN_MIRROR} ${release}-backports main contrib non-free
|
||||
#deb-src http://${DEBIAN_MIRROR} ${release}-backports main contrib non-free
|
||||
|
||||
deb http://${DEBIAN_SECURTY} ${release}/updates main contrib non-free
|
||||
#deb-src http://${DEBIAN_SECURTY} ${release}/updates main contrib non-free
|
||||
EOF
|
||||
;;
|
||||
deb http://${DEBIAN_SECURTY} ${release}/updates main contrib non-free
|
||||
#deb-src http://${DEBIAN_SECURTY} ${release}/updates main contrib non-free
|
||||
EOF
|
||||
;;
|
||||
|
||||
bullseye|bookworm|trixie)
|
||||
cat <<-EOF > "${basedir}"/etc/apt/sources.list
|
||||
deb http://${DEBIAN_MIRROR} $release main contrib non-free
|
||||
#deb-src http://${DEBIAN_MIRROR} $release main contrib non-free
|
||||
bullseye | bookworm | trixie)
|
||||
cat <<- EOF > "${basedir}"/etc/apt/sources.list
|
||||
deb http://${DEBIAN_MIRROR} $release main contrib non-free
|
||||
#deb-src http://${DEBIAN_MIRROR} $release main contrib non-free
|
||||
|
||||
deb http://${DEBIAN_MIRROR} ${release}-updates main contrib non-free
|
||||
#deb-src http://${DEBIAN_MIRROR} ${release}-updates main contrib non-free
|
||||
deb http://${DEBIAN_MIRROR} ${release}-updates main contrib non-free
|
||||
#deb-src http://${DEBIAN_MIRROR} ${release}-updates main contrib non-free
|
||||
|
||||
deb http://${DEBIAN_MIRROR} ${release}-backports main contrib non-free
|
||||
#deb-src http://${DEBIAN_MIRROR} ${release}-backports main contrib non-free
|
||||
deb http://${DEBIAN_MIRROR} ${release}-backports main contrib non-free
|
||||
#deb-src http://${DEBIAN_MIRROR} ${release}-backports main contrib non-free
|
||||
|
||||
deb http://${DEBIAN_SECURTY} ${release}-security main contrib non-free
|
||||
#deb-src http://${DEBIAN_SECURTY} ${release}-security main contrib non-free
|
||||
EOF
|
||||
;;
|
||||
deb http://${DEBIAN_SECURTY} ${release}-security main contrib non-free
|
||||
#deb-src http://${DEBIAN_SECURTY} ${release}-security main contrib non-free
|
||||
EOF
|
||||
;;
|
||||
|
||||
sid) # sid is permanent unstable development and has no such thing as updates or security
|
||||
cat <<-EOF > "${basedir}"/etc/apt/sources.list
|
||||
deb http://${DEBIAN_MIRROR} $release main contrib non-free
|
||||
#deb-src http://${DEBIAN_MIRROR} $release main contrib non-free
|
||||
EOF
|
||||
;;
|
||||
sid) # sid is permanent unstable development and has no such thing as updates or security
|
||||
cat <<- EOF > "${basedir}"/etc/apt/sources.list
|
||||
deb http://${DEBIAN_MIRROR} $release main contrib non-free
|
||||
#deb-src http://${DEBIAN_MIRROR} $release main contrib non-free
|
||||
EOF
|
||||
;;
|
||||
|
||||
focal|jammy)
|
||||
cat <<-EOF > "${basedir}"/etc/apt/sources.list
|
||||
deb http://${UBUNTU_MIRROR} $release main restricted universe multiverse
|
||||
#deb-src http://${UBUNTU_MIRROR} $release main restricted universe multiverse
|
||||
focal | jammy)
|
||||
cat <<- EOF > "${basedir}"/etc/apt/sources.list
|
||||
deb http://${UBUNTU_MIRROR} $release main restricted universe multiverse
|
||||
#deb-src http://${UBUNTU_MIRROR} $release main restricted universe multiverse
|
||||
|
||||
deb http://${UBUNTU_MIRROR} ${release}-security main restricted universe multiverse
|
||||
#deb-src http://${UBUNTU_MIRROR} ${release}-security main restricted universe multiverse
|
||||
deb http://${UBUNTU_MIRROR} ${release}-security main restricted universe multiverse
|
||||
#deb-src http://${UBUNTU_MIRROR} ${release}-security main restricted universe multiverse
|
||||
|
||||
deb http://${UBUNTU_MIRROR} ${release}-updates main restricted universe multiverse
|
||||
#deb-src http://${UBUNTU_MIRROR} ${release}-updates main restricted universe multiverse
|
||||
deb http://${UBUNTU_MIRROR} ${release}-updates main restricted universe multiverse
|
||||
#deb-src http://${UBUNTU_MIRROR} ${release}-updates main restricted universe multiverse
|
||||
|
||||
deb http://${UBUNTU_MIRROR} ${release}-backports main restricted universe multiverse
|
||||
#deb-src http://${UBUNTU_MIRROR} ${release}-backports main restricted universe multiverse
|
||||
EOF
|
||||
;;
|
||||
deb http://${UBUNTU_MIRROR} ${release}-backports main restricted universe multiverse
|
||||
#deb-src http://${UBUNTU_MIRROR} ${release}-backports main restricted universe multiverse
|
||||
EOF
|
||||
;;
|
||||
esac
|
||||
|
||||
display_alert "Adding Armbian repository and authentication key" "/etc/apt/sources.list.d/armbian.list" "info"
|
||||
@@ -173,9 +171,9 @@ create_sources_list()
|
||||
if [[ $DOWNLOAD_MIRROR == "china" ]]; then
|
||||
echo "deb ${SIGNED_BY}https://mirrors.tuna.tsinghua.edu.cn/armbian $RELEASE main ${RELEASE}-utils ${RELEASE}-desktop" > "${basedir}"/etc/apt/sources.list.d/armbian.list
|
||||
elif [[ $DOWNLOAD_MIRROR == "bfsu" ]]; then
|
||||
echo "deb ${SIGNED_BY}http://mirrors.bfsu.edu.cn/armbian $RELEASE main ${RELEASE}-utils ${RELEASE}-desktop" > "${basedir}"/etc/apt/sources.list.d/armbian.list
|
||||
echo "deb ${SIGNED_BY}http://mirrors.bfsu.edu.cn/armbian $RELEASE main ${RELEASE}-utils ${RELEASE}-desktop" > "${basedir}"/etc/apt/sources.list.d/armbian.list
|
||||
else
|
||||
echo "deb ${SIGNED_BY}http://"$([[ $BETA == yes ]] && echo "beta" || echo "apt" )".armbian.com $RELEASE main ${RELEASE}-utils ${RELEASE}-desktop" > "${basedir}"/etc/apt/sources.list.d/armbian.list
|
||||
echo "deb ${SIGNED_BY}http://"$([[ $BETA == yes ]] && echo "beta" || echo "apt")".armbian.com $RELEASE main ${RELEASE}-utils ${RELEASE}-desktop" > "${basedir}"/etc/apt/sources.list.d/armbian.list
|
||||
fi
|
||||
|
||||
# replace local package server if defined. Suitable for development
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
post_debootstrap_tweaks()
|
||||
{
|
||||
post_debootstrap_tweaks() {
|
||||
|
||||
# remove service start blockers and QEMU binary
|
||||
rm -f "${SDCARD}"/sbin/initctl "${SDCARD}"/sbin/start-stop-daemon
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
desktop_postinstall ()
|
||||
{
|
||||
desktop_postinstall() {
|
||||
|
||||
# disable display manager for the first run
|
||||
run_on_sdcard "systemctl --no-reload disable lightdm.service >/dev/null 2>&1"
|
||||
|
||||
Reference in New Issue
Block a user