From 605f3b2d0bfcbd51643ef9d647088ec244bf9e13 Mon Sep 17 00:00:00 2001 From: Thomas Glanzmann Date: Tue, 8 Feb 2022 15:02:56 +0100 Subject: [PATCH] add license --- LICENSE | 20 +++++++++++++++ bootstrap.sh | 2 ++ pmdi.pl | 71 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 93 insertions(+) create mode 100644 LICENSE create mode 100644 pmdi.pl diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..b15f619 --- /dev/null +++ b/LICENSE @@ -0,0 +1,20 @@ +Copyright (c) 2022 The Asahi Linux contributors + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/bootstrap.sh b/bootstrap.sh index 475c20d..20b1c13 100644 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -1,5 +1,7 @@ #!/bin/bash +# SPDX-License-Identifier: MIT + set -x set -e diff --git a/pmdi.pl b/pmdi.pl new file mode 100644 index 0000000..12884d4 --- /dev/null +++ b/pmdi.pl @@ -0,0 +1,71 @@ +#!/usr/bin/perl + +# SPDX-License-Identifier: MIT + +use strict; + +my ($identifier, $size); + +sub +find_identifier_before_free_space +{ + my $identifier = undef; + my $size = undef; + + for my $line (`diskutil list /dev/disk0`) { + + if ($line =~ /^\s+\(free space\)\s+(\d+.\d GB)/) { + $size = $1; + $size =~ s/\s+//g; + last; + } + + if ($line =~ /(disk0s\d)$/) { + $identifier = $1; + } + } + + die if not defined $identifier; + die if not defined $size; + + return ($identifier, $size); +} + +($identifier, $size) = find_identifier_before_free_space(); +system("diskutil addPartition $identifier %EFI% LB 512MB"); + +$identifier = undef; + +for my $line (`diskutil list /dev/disk0`) { + if ($line =~ /EFI.*(disk0s\d)/) { + $identifier = $1; + } +} + +die if not defined $identifier; + +system("newfs_msdos /dev/$identifier"); +system("mkdir -p /Volumes/efi"); +system("mount -t msdos /dev/$identifier /Volumes/efi"); +chdir('/Volumes/efi'); +system('mkdir -p /Volumes/efi/efi/boot'); +system('curl -Lo /Volumes/efi/efi/boot/bootaa64.efi https://tg.st/u/grubaa64.efi'); +system('curl -sL tg.st/u/fwx.sh | bash'); +system('cp /tmp/linux-firmware.tar /Volumes/efi/'); +chdir('/var/root'); +system('umount /Volumes/efi'); + +($identifier, $size) = find_identifier_before_free_space(); +system("diskutil addPartition $identifier %Linux% %noformat% $size"); + +$identifier = undef; + +for my $line (`diskutil list /dev/disk0`) { + if ($line =~ /Linux Filesystem.*(disk0s\d)/) { + $identifier = $1; + } +} + +die if not defined $identifier; + +system("curl -L https://tg.st/u/m1.tgz | tar -xOz | dd of=/dev/$identifier bs=8m"); -- 2.39.5