makelni/common.d/common.rpm.sh

95 lines
2.2 KiB
Bash

#!/usr/bin/env bash
source ./common.d/functions.sh
source ./common.d/build_functions.sh
require "debootstrap"
fetch_base_system()
{
log "fetch_base_system is not implemented for rpm profiles" ierror
log "Use distro specific type. Or implement your own" ierror
return 3
}
prepare_system()
{
log "prepare_system is not implemented for rpm imahe type" ierror
log "Use distro-specific image type. Or implement your own" ierror
return 3
}
setup_zram_generator()
{
log "setup_zram_generator is not implemented for rpm imahe type" ierror
log "Use distro-specific image type. Or implement your own" ierror
return 3
}
install_nabu_packages()
{
local rootdir="$1"
[ ! -d "$rootdir" ] && {
log "Rootdir [$rootdir] does not exists" ierror
return 2
}
cp ./packages/*.rpm "$rootdir/opt/"
chroot "$rootdir" bash -c "rpm -i /opt/*.rpm" || {
log "Failed to install packages" ierror
return 1
}
chroot "$rootdir" bash -c "rm /opt/*.rpm"
log "Enabling userspace services" internal
chroot "$rootdir" systemctl enable qrtr-ns pd-mapper tqftpserv rmtfs || {
log "Failed to enable services" ierror
return 1
}
return 0
}
# shellcheck disable=SC2086
install_packages()
{
local rootdir="$1"
local packages="${*:2}"
[ ! -d "$rootdir" ] && {
log "Rootdir [$rootdir] does not exists" ierror
return 2
}
chroot "$rootdir" dnf install $packages -y || {
log "Failed to install package(s)" ierror
return 1
}
return 0
}
finish_system()
{
local rootdir="$1"
[ ! -d "$rootdir" ] && {
log "Rootdir [$rootdir] does not exists" ierror
return 2
}
log "Cleaning dnf cache" internal
chroot "$rootdir" dnf clean all || {
log "Failed to clean dnf cache" ierror
return 1
}
log "Updating runtime linker bindings" internal
chroot "$rootdir" ldconfig || {
log "Failed to update runtime linker bindings" ierror
return 1
}
[ -L "$rootdir/etc/resolv.conf.1" ] && {
log "Restoring resolv.conf symlink"
mv "$rootdir/etc/resolv.conf.1" "$rootdir/etc/resolv.conf"
}
return 0
}