mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 13:27:35 +00:00
Meta: Add install-native-partition CMake target installing to a real FS
While playing around with getting serenity to run on my main desktop machine I wanted a way of easily updating my physical serenity partition. To use it you just need to: - Create and format your local partition to ext4 - Set `SERENITY_TARGET_INSTALL_PARTITION` to the partition /dev path. - Run the `install-native-partition` build target. Example: $ export SERENITY_TARGET_INSTALL_PARTITION=/dev/nvme1n1p3 $ cd serenity/Build/x86_64 $ ninja install-native-partition
This commit is contained in:
parent
6ec4fd9d3c
commit
ee61739e0a
2 changed files with 51 additions and 0 deletions
47
Meta/build-native-partition.sh
Executable file
47
Meta/build-native-partition.sh
Executable file
|
@ -0,0 +1,47 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
die() {
|
||||
echo "die: $*"
|
||||
exit 1
|
||||
}
|
||||
|
||||
cleanup() {
|
||||
if [ -d mnt ]; then
|
||||
umount mnt || ( sleep 1 && sync && umount mnt )
|
||||
rmdir mnt
|
||||
echo "done"
|
||||
fi
|
||||
}
|
||||
|
||||
if [ "$(id -u)" != 0 ]; then
|
||||
sudo -E -- "$0" "$@" || die "this script needs to run as root"
|
||||
exit 0
|
||||
else
|
||||
: "${SUDO_UID:=0}" "${SUDO_GID:=0}"
|
||||
fi
|
||||
|
||||
if [ -z "$SERENITY_TARGET_INSTALL_PARTITION" ]; then
|
||||
die "SERENITY_TARGET_INSTALL_PARTITION environment variable was not set!"
|
||||
fi
|
||||
|
||||
printf "verifying partition %s is already ext2... " "$SERENITY_TARGET_INSTALL_PARTITION"
|
||||
if file -sL "$SERENITY_TARGET_INSTALL_PARTITION" 2>&1 | grep "ext2" > /dev/null; then
|
||||
echo "done"
|
||||
else
|
||||
die "$SERENITY_TARGET_INSTALL_PARTITION is not an ext2 partition!"
|
||||
fi
|
||||
|
||||
trap cleanup EXIT
|
||||
|
||||
printf "mounting filesystem on device %s... " "$SERENITY_TARGET_INSTALL_PARTITION"
|
||||
mkdir -p mnt
|
||||
if ! eval "mount $SERENITY_TARGET_INSTALL_PARTITION mnt/"; then
|
||||
die "could not mount existing ext2 filesystem on $SERENITY_TARGET_INSTALL_PARTITION"
|
||||
else
|
||||
echo "done"
|
||||
fi
|
||||
|
||||
script_path=$(cd -P -- "$(dirname -- "$0")" && pwd -P)
|
||||
"$script_path/build-root-filesystem.sh"
|
Loading…
Add table
Add a link
Reference in a new issue