fixed issue with dirs
This commit is contained in:
parent
ab496871ad
commit
95162c581c
@ -2,18 +2,21 @@
|
||||
cd -- "$( dirname -- "${BASH_SOURCE[0]}" )"
|
||||
source creator_exports.sh
|
||||
source creator_functions.sh
|
||||
rm -rf "$ROOT" 2>/dev/null
|
||||
mkdir -p build "$ROOT" "${ROOT}/usr/bin/"
|
||||
mkdir -p build
|
||||
cd build
|
||||
|
||||
echo_blue "Starting installation at $ROOT."
|
||||
create_dirs
|
||||
|
||||
echo_blue "Adding kernel binaries..."
|
||||
install_busybox
|
||||
install_binary $(which modprobe)
|
||||
install_binary $(which switch_root)
|
||||
install_binary $(which bash)
|
||||
|
||||
echo_blue "Adding scripts..."
|
||||
install_init_script
|
||||
|
||||
echo_blue "Adding kernel modules..."
|
||||
install_module "$(df -T / | awk '{ print $2 }' | tail -1)"
|
||||
install_module msr
|
||||
@ -21,5 +24,6 @@ install_module sev-guest
|
||||
install_module dm_crypt
|
||||
cp /lib/modules/${KERNEL}/modules.{order,builtin,builtin.modinfo} "${ROOT}/lib/modules/${KERNEL}/"
|
||||
depmod -b "$ROOT" "$KERNEL"
|
||||
|
||||
echo_blue "Creating archive..."
|
||||
create_archive
|
||||
|
@ -12,6 +12,19 @@ echo_red() {
|
||||
echo -e "\033[0;31m$1\033[0m"
|
||||
}
|
||||
|
||||
create_dirs() {
|
||||
rm -rf "$ROOT" 2>/dev/null
|
||||
mkdir -p "$ROOT" "${ROOT}/usr/bin/"
|
||||
mkdir -p ${ROOT}/usr/bin
|
||||
mkdir -p ${ROOT}/usr/lib
|
||||
ln -s usr/bin ${ROOT}/bin
|
||||
ln -s usr/bin ${ROOT}/sbin
|
||||
ln -s usr/lib ${ROOT}/lib
|
||||
ln -s usr/lib ${ROOT}/lib64
|
||||
ln -s lib ${ROOT}/usr/lib64
|
||||
ln -s bin ${ROOT}/usr/sbin
|
||||
}
|
||||
|
||||
# Installs a library. Expects absolute path.
|
||||
install_dep() {
|
||||
local lib="$1"
|
||||
@ -58,7 +71,7 @@ install_busybox() {
|
||||
exit 1
|
||||
}
|
||||
install_binary "$BUSYBOX_PATH" || return 1
|
||||
for applet in $(/usr/lib/initcpio/busybox --list); do
|
||||
for applet in $($BUSYBOX_PATH --list); do
|
||||
ln -s busybox "${ROOT}/usr/bin/$applet"
|
||||
done
|
||||
}
|
||||
@ -68,13 +81,6 @@ install_init_script() {
|
||||
cp ../init_functions.sh ${ROOT}/
|
||||
}
|
||||
|
||||
create_archive() {
|
||||
local archive="detee-$(hostnamectl hostname)-${KERNEL}.cpio.gz"
|
||||
echo_blue "Creating archive $archive"
|
||||
echo $archive > .archive_name
|
||||
find . | cpio -o -H newc | gzip > detee-$(hostnamectl hostname)-${KERNEL}.cpio.gz
|
||||
}
|
||||
|
||||
install_module() {
|
||||
local module="$1" depends='' dep='' filename=''
|
||||
filename="$( modinfo -k $KERNEL $module | grep '^filename:' | awk '{ print $2 }' )"
|
||||
@ -93,3 +99,14 @@ install_module() {
|
||||
install_module "$dep"
|
||||
done <<< "$( echo "$depends" )"
|
||||
}
|
||||
|
||||
create_archive() {
|
||||
local archive="detee-$(hostnamectl hostname)-${KERNEL}.cpio.gz"
|
||||
echo_blue "Creating archive $archive"
|
||||
echo $archive > .archive_name
|
||||
my_location="$(pwd)"
|
||||
cd ${ROOT}
|
||||
find . | cpio -o -H newc | gzip > "${my_location}/detee-$(hostnamectl hostname)-${KERNEL}.cpio.gz"
|
||||
|
||||
cd $my_location
|
||||
}
|
||||
|
@ -34,5 +34,5 @@ create_mounts() {
|
||||
}
|
||||
|
||||
mount_root() {
|
||||
mount /dev/vda1 /mnt
|
||||
mount /dev/vda3 /mnt
|
||||
}
|
||||
|
12
install.sh
12
install.sh
@ -24,16 +24,20 @@ else
|
||||
scp="scp -P $3"
|
||||
fi
|
||||
|
||||
echo
|
||||
echo Starting installation...
|
||||
echo
|
||||
|
||||
tar cf dtrfs.tar *.sh
|
||||
set -e
|
||||
|
||||
mkdir -p tmp
|
||||
tar cf tmp/dtrfs.tar *.sh
|
||||
$ssh $server rm -rf ${dir}
|
||||
$ssh $server mkdir -p ${dir}
|
||||
$scp dtrfs.tar ${server}:${dir}
|
||||
$scp tmp/dtrfs.tar ${server}:${dir}
|
||||
$ssh $server tar -xf ${dir}/dtrfs.tar -C ${dir}
|
||||
$ssh $server ${dir}/create.sh
|
||||
set -e
|
||||
archive=$($ssh $server cat ${dir}/build/.archive_name)
|
||||
mkdir -p tmp
|
||||
$scp ${server}:${dir}/build/${archive} tmp/
|
||||
echo
|
||||
echo initrd downloaded to: $(pwd)/tmp/${archive}
|
||||
|
Loading…
Reference in New Issue
Block a user