common_rpm: Add rpm profile
This commit is contained in:
parent
7aaee141f5
commit
7b6b519f96
94
common.d/common.rpm.sh
Normal file
94
common.d/common.rpm.sh
Normal file
|
@ -0,0 +1,94 @@
|
|||
#!/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
|
||||
}
|
||||
|
Loading…
Reference in a new issue