-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlinuxmac.sh
140 lines (130 loc) · 5.98 KB
/
linuxmac.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
#!/usr/bin/env zsh
# This needs testing btw
case "$USER:l" in
*"djafar"*)
echo "Hi Djafar"
sleep 0.5 ;;*)
esac
# Hi Djafar.
devmode=false
if [ "$1" = "e" ]; then
devmode=true
fi
#You didn't see this.
bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# Just installs/updates brew bro trust
brew install curl git
# Use brew to install necessary packages
cpuHardware=$(sysctl -n machdep.cpu.brand_string | tr '[:upper:]' '[:lower:]')
# Finds your CPU vendor
echo "In the unlikely case of corruption and/or data loss, the developers of this script are not responsible.\nIt is recommended to make backups before running this script."
sleep 2
case $cpuHardware in
*"intel"*)
# Intel Distros
echo "This script currently does not support Intel CPUs, please wait for a future release."
if [ $devmode = true ]; then # Executes if dev mode is on since this is probably not very safe to test
echo "Type the name of the Linux distro do you want to install from the list and press enter[]"
read distro
distro=$(echo "$distro" | tr '[:upper:]' '[:lower:]')
# Gets distro to use from user input
diskutil list
# Show all the disks and info
echo "Choose a disk to to install Linux on (Type the identifier next to it and press enter): "
read disk
# Get the disk to use from user input
echo "How much space should be allocated to Linux (in GB): "
read size
# Get disk space to use from user input
fi ;;*)
# Apple Silicon Distros
echo "Please type in the name of the distro from the list you want to install and then press enter [fedora, alpinelinux, arch, aosc, centos, debian, deepin, gentoo, nixos, rockylinux, ubuntu, voidlinux]: "
read distro # Get user input of what distro they want to use
distro=$(echo "$distro" | tr '[:upper:]' '[:lower:]')
case $distro in
"fedora")
# Check if the user input is fedora
echo "Installing fedora..."
curl https://alx.sh | sh
echo "Fedora has now been fully configured."
if [ $devmode = true ]; then
input="y"
echo "Press y now to boot into recovery mode. Press any other key to cancel."
read $input
if [ $input = "y" ]; then
# TODO
fi
fi ;;
# More distro checking below this haha
"alpinelinux"*)
echo "The default user for this is root"
sleep 1.5
curl https://arvanta.net/asahi/aai.sh | sh ;;
"arch"*)
#echo "Arch is currently not implemented, wait for a future release."
echo "This one requires stupid config stuff go to https://github.com/asahi-alarm/asahi-alarm/blob/main/manual-install.md and read about it after the installer is done. (Just click the link and it should take you right there.)"
sleep 2
curl -SL https://github.com/asahi-alarm/asahi-alarm/releases/download/installer/installer-bootstrap.sh | sh ;;
"aosc"*)
#echo "AOSC is currently not implemented, wait for a future release."
curl -sSf https://repo.aosc.io/get-oma.sh | sudo sh ;;
"centos"*)
#echo "CentOS is currently not implemented, wait for a future release."
echo "Root password for this is centosstream"
sleep 1.5
curl https://ecurtin.fedorapeople.org/centos.sh | sh ;;
"debian"*)
# The Debian installer needs to be tested outside of this script because the documentation for it might just be wrong.
#echo "Debian is currently not implemented, wait for a future release."
curl -sL https://tg.st/d | sh ;;
"deepin"*)
#echo "Deepin is currently not implemented, wait for a future release."
# More research is necessary for this one since it's in a different language
curl https://ci.deepin.com/repo/deepin/deepin-ports/deepin-m1/deepin.install | sh;;
"gentoo"*)
# After reading the guide, AAAAAAAAAAAAAA
echo "Gentoo is currently not implemented, wait for a future release."
if [ $devmode = true ]; then
echo "You need a USB stick plugged in for this one"
sleep 1.5
fi ;;
"nixos"*)
# Later.
echo "NixOS is currently not implemented, wait for a future release."
if [ $devmode = true ]; then
echo "You need a USB stick plugged in for this one"
sleep 1.5
git clone https://github.com/tpwrules/nixos-apple-silicon/
cd nixos-apple-silicon
nix build --extra-experimental-features 'nix-command flakes' .#m1n1 -o m1n1
nix build --extra-experimental-features 'nix-command flakes' .#uboot-asahi -o u-boot
nix build --extra-experimental-features 'nix-command flakes' .#installer-bootstrap -o installer -j4 -L
curl https://alx.sh | sh
# From here it gets pretty complicated and I'll do it later
fi;;
"rockylinux"*)
#echo "Rocky Linux is currently not implemented, wait for a future release."
echo "Root password for this is rocky"
sleep 1.5
curl https://leifliddy.com/rocky.sh | sh ;;
"ubuntu"*)
#echo "Ubuntu is currently not implemented, wait for a future release."
curl -sL https://ubuntuasahi.org/install | sh ;;
"voidlinux"*)
#echo "Void Linux is currently not implemented, wait for a future release."
echo "Root password for this is voidlinux"
sleep 1.5
curl -L https://tinyurl.com/void-asahi | sh ;;
*)
echo "The distro you have selected currently does not support Apple Silicon (or you misspelled it) and there are currently no plans to implement it." ;;
esac
esac
#sudo nvram "recovery-boot-mode=unused"
# or
#sudo nvram internet-recovery-mode=RecoveryModeDisk
# then
#sudo reboot
# To boot into recovery mode
#nvram -d recovery-boot-mode
# To stop it from continuing to boot into recovery mode
# We should also have a press enter to boot into recovery mode or something like that when we use this