├── .gitignore ├── Dockerfile ├── LICENSE ├── README.md ├── buildme.sh ├── docker-build-mac.sh ├── factory-restore.md ├── initial_configuration.sh ├── mac-install-internal.sh ├── mac-install.sh ├── tools ├── mount-efi.sh └── remove-rEFInd.sh └── uninstall.sh /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | VdgxPO 3 | 4 | *.dmg 5 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | ############################################################ 2 | # Copyright (c) 2015 Jonathan Yantis 3 | # Released under the MIT license 4 | ############################################################ 5 | 6 | # ├─yantis/archlinux-tiny 7 | # ├─yantis/archlinux-small 8 | # ├─yantis/archlinux-mac-installer 9 | 10 | # Dockerhub can not handle uploading layers above 500MB 11 | # The layers time out on upload. Also, if a single RUN command 12 | # takes to long to run Dockerhub will fail to build it so 13 | # breaking them down into smaller chunks even if more redundant. 14 | # Dockerhub also can not handle lots of pacman signature checks 15 | # As it times out at exactly two hours. 16 | 17 | FROM yantis/archlinux-small 18 | MAINTAINER Jonathan Yantis 19 | 20 | 21 | ############################################################################### 22 | # Install permanent additions to the container. 23 | ############################################################################### 24 | # Don't update to avoid breaking things 25 | RUN pacman --noconfirm -Syy && \ 26 | 27 | # create run remote script and make it exectutable 28 | bash -c "echo 'curl -L \$1 | sh' > /bin/run-remote-script" && \ 29 | chmod +x /bin/run-remote-script && \ 30 | 31 | 32 | # Disable sig checking on the main repos since that is what times it out. 33 | # Not really want I want to do but with the 100+ build errors on dockerhub 34 | # This is the only solution that works. 35 | # It gets it all from mirrors.kernel.org so it should be fine. 36 | sed -i "s/\[core\]/\[core\]\nSigLevel = Never/" /etc/pacman.conf && \ 37 | sed -i "s/\[extra\]/\[extra\]\nSigLevel = Never/" /etc/pacman.conf && \ 38 | sed -i "s/\[community\]/\[community\]\nSigLevel = Never/" /etc/pacman.conf && \ 39 | 40 | # Remove the texinfo-fake package since we are installing perl for rsync. 41 | # pacman --noconfirm -Rdd texinfo-fake && \ 42 | 43 | # Install stuff we will need later 44 | pacman --noconfirm --needed -S \ 45 | perl \ 46 | texinfo \ 47 | rsync \ 48 | squashfs-tools && \ 49 | 50 | # Clean up to make this as small as possible 51 | localepurge && \ 52 | 53 | # Remove info, man and docs (only in this container.. not on our new install) 54 | rm -r /usr/share/info/* && \ 55 | rm -r /usr/share/man/* && \ 56 | 57 | # Delete any backup files like /etc/pacman.d/gnupg/pubring.gpg~ 58 | find /. -name "*~" -type f -delete && \ 59 | 60 | # Clean up pacman 61 | bash -c "echo 'y' | pacman -Scc >/dev/null 2>&1" && \ 62 | paccache -rk0 >/dev/null 2>&1 && \ 63 | pacman-optimize && \ 64 | rm -r /var/lib/pacman/sync/* 65 | 66 | 67 | ############################################################################### 68 | # Build and Cache NVIDA Drivers 69 | # 349xx series drivers are problematic on the Macbooks so using 346xx 70 | ############################################################################### 71 | RUN pacman --noconfirm -Sy binutils gcc make autoconf fakeroot && \ 72 | 73 | # create custom cache locations 74 | mkdir -p /var/cache/pacman/custom && \ 75 | 76 | # build and cache nvidia-346xx-dkms package 77 | wget -P /tmp https://aur.archlinux.org/cgit/aur.git/snapshot/nvidia-346xx-dkms.tar.gz && \ 78 | tar -xvf /tmp/nvidia-346xx-dkms.tar.gz -C /tmp && \ 79 | chown -R docker:docker /tmp/nvidia-346xx-dkms && \ 80 | runuser -l docker -c "(cd /tmp/nvidia-346xx-dkms && makepkg -scd --noconfirm)" && \ 81 | mv /tmp/nvidia-346xx-dkms/*.xz /var/cache/pacman/custom/ && \ 82 | rm -r /tmp/* && \ 83 | 84 | # build and cache nvidia-346xx-utils package 85 | wget -P /tmp https://aur.archlinux.org/cgit/aur.git/snapshot/nvidia-346xx-utils.tar.gz && \ 86 | tar -xvf /tmp/nvidia-346xx-utils.tar.gz -C /tmp && \ 87 | chown -R docker:docker /tmp/nvidia-346xx-utils && \ 88 | runuser -l docker -c "(cd /tmp/nvidia-346xx-utils && makepkg -scd --noconfirm)" && \ 89 | mv /tmp/nvidia-346xx-utils/*.xz /var/cache/pacman/custom/ && \ 90 | rm -r /tmp/* && \ 91 | 92 | # build and cache nvidia-hook package 93 | # Doesn't exit anymore. Lets hope it doesn't break things 94 | # wget -P /tmp https://aur.archlinux.org/cgit/aur.git/snapshot/nvidia-hook.tar.gz && \ 95 | # tar -xvf /tmp/nvidia-hook.tar.gz -C /tmp && \ 96 | # chown -R docker:docker /tmp/nvidia-hook && \ 97 | # runuser -l docker -c "(cd /tmp/nvidia-hook && makepkg -scd --noconfirm)" && \ 98 | # mv /tmp/nvidia-hook/*.xz /var/cache/pacman/custom/ && \ 99 | # rm -r /tmp/* && \ 100 | 101 | # Remove anything we added that we do not need 102 | pacman --noconfirm -Rs binutils gcc make autoconf fakeroot && \ 103 | 104 | # Remove info & man 105 | rm -r /usr/share/info/* && \ 106 | rm -r /usr/share/man/* && \ 107 | 108 | # Clean up pacman 109 | bash -c "echo 'y' | pacman -Scc >/dev/null 2>&1" && \ 110 | paccache -rk0 >/dev/null 2>&1 && \ 111 | pacman-optimize && \ 112 | rm -r /var/lib/pacman/sync/* 113 | 114 | 115 | ############################################################################### 116 | # Build any packages we may need to install. 117 | ############################################################################### 118 | RUN pacman --noconfirm --needed -Sy base-devel && \ 119 | 120 | # Build & cache xf86-input-mtrack-git package 121 | # wget -P /tmp https://aur.archlinux.org/packages/xf/xf86-input-mtrack-git/xf86-input-mtrack-git.tar.gz && \ 122 | wget -P /tmp https://aur.archlinux.org/cgit/aur.git/snapshot/xf86-input-mtrack-git.tar.gz && \ 123 | tar -xvf /tmp/xf86-input-mtrack-git.tar.gz -C /tmp && \ 124 | chown -R docker:docker /tmp/xf86-input-mtrack-git && \ 125 | runuser -l docker -c "(cd /tmp/xf86-input-mtrack-git && makepkg -sc --noconfirm)" && \ 126 | mv /tmp/xf86-input-mtrack-git/*.xz /var/cache/pacman/custom/ && \ 127 | 128 | # Build & cache nvidia-bl-dkms package 129 | # wget -P /tmp https://aur.archlinux.org/packages/nv/nvidia-bl-dkms/nvidia-bl-dkms.tar.gz && \ 130 | # tar -xvf /tmp/nvidia-bl-dkms.tar.gz -C /tmp && \ 131 | # chown -R docker:docker /tmp/nvidia-bl-dkms && \ 132 | # runuser -l docker -c "(cd /tmp/nvidia-bl-dkms && makepkg -sc --noconfirm)" && \ 133 | # mv /tmp/nvidia-bl-dkms/*.xz /var/cache/pacman/custom/ && \ 134 | 135 | # extract the firmware for the b43 (even if the user doesn't need it. It doesn't hurt) 136 | # https://wiki.archlinux.org/index.php/Broadcom_wireless 137 | pacman --noconfirm -S b43-fwcutter && \ 138 | curl -LO http://downloads.openwrt.org/sources/broadcom-wl-4.178.10.4.tar.bz2 && \ 139 | tar xjf broadcom-wl-4.178.10.4.tar.bz2 && \ 140 | mkdir /firmware && \ 141 | b43-fwcutter -w /firmware broadcom-wl-4.178.10.4/linux/wl_apsta.o && \ 142 | rm -r broadcom-wl* && \ 143 | pacman --noconfirm -Rs b43-fwcutter && \ 144 | 145 | # create general cache location 146 | mkdir -p /var/cache/pacman/general && \ 147 | 148 | # Build & cache thermald package 149 | # wget -P /tmp https://aur.archlinux.org/packages/th/thermald/thermald.tar.gz && \ 150 | wget -P /tmp https://aur.archlinux.org/cgit/aur.git/snapshot/thermald.tar.gz && \ 151 | tar -xvf /tmp/thermald.tar.gz -C /tmp && \ 152 | chown -R docker:docker /tmp/thermald && \ 153 | runuser -l docker -c "(cd /tmp/thermald && makepkg -sc --noconfirm)" && \ 154 | mv /tmp/thermald/*.xz /var/cache/pacman/general/ && \ 155 | 156 | # build and cache mbpfan-git package 157 | # wget -P /tmp https://aur.archlinux.org/packages/mb/mbpfan-git/mbpfan-git.tr.gz && \ 158 | wget -P /tmp https://aur.archlinux.org/cgit/aur.git/snapshot/mbpfan-git.tar.gz && \ 159 | tar -xvf /tmp/mbpfan-git.tar.gz -C /tmp && \ 160 | chown -R docker:docker /tmp/mbpfan-git && \ 161 | runuser -l docker -c "(cd /tmp/mbpfan-git && makepkg -sc --noconfirm)" && \ 162 | mv /tmp/mbpfan-git/*.xz /var/cache/pacman/custom/ && \ 163 | rm -r /tmp/* && \ 164 | 165 | # Download broadcom and intel drivers. 166 | pacman --noconfirm -Sw --cachedir /var/cache/pacman/custom \ 167 | broadcom-wl-dkms \ 168 | xf86-video-intel && \ 169 | 170 | # Download and cache Liberation TTF Mono Powerline Fonts 171 | # wget -P /tmp https://aur.archlinux.org/packages/tt/ttf-liberation-mono-powerline-git/ttf-liberation-mono-powerline-git.tar.gz && \ 172 | wget -P /tmp https://aur.archlinux.org/cgit/aur.git/snapshot/ttf-literation-mono-powerline-git.tar.gz && \ 173 | tar -xvf /tmp/ttf-literation-mono-powerline-git.tar.gz -C /tmp && \ 174 | chown -R docker:docker /tmp/ttf-literation-mono-powerline-git && \ 175 | runuser -l docker -c "(cd /tmp/ttf-literation-mono-powerline-git && makepkg -sc --noconfirm)" && \ 176 | mv /tmp/ttf-literation-mono-powerline-git/*.xz /var/cache/pacman/general/ && \ 177 | rm -r /tmp/* && \ 178 | 179 | # Download and cache oh-my-zsh 180 | # wget -P /tmp https://aur.archlinux.org/packages/oh/oh-my-zsh-git/oh-my-zsh-git.tar.gz && \ 181 | wget -P /tmp https://aur.archlinux.org/cgit/aur.git/snapshot/oh-my-zsh-git.tar.gz && \ 182 | tar -xvf /tmp/oh-my-zsh-git.tar.gz -C /tmp && \ 183 | chown -R docker:docker /tmp/oh-my-zsh-git && \ 184 | runuser -l docker -c "(cd /tmp/oh-my-zsh-git && makepkg -sc --noconfirm)" && \ 185 | mv /tmp/oh-my-zsh-git/*.xz /var/cache/pacman/general/ && \ 186 | rm -r /tmp/* && \ 187 | 188 | # Download and cache bullet-train-oh-my-zsh-theme-git 189 | # wget -P /tmp https://aur.archlinux.org/packages/bu/bullet-train-oh-my-zsh-theme-git/bullet-train-oh-my-zsh-theme-git.tar.gz && \ 190 | wget -P /tmp https://aur.archlinux.org/cgit/aur.git/snapshot/bullet-train-oh-my-zsh-theme-git.tar.gz && \ 191 | tar -xvf /tmp/bullet-train-oh-my-zsh-theme-git.tar.gz -C /tmp && \ 192 | chown -R docker:docker /tmp/bullet-train-oh-my-zsh-theme-git && \ 193 | runuser -l docker -c "(cd /tmp/bullet-train-oh-my-zsh-theme-git && makepkg -sc --noconfirm)" && \ 194 | mv /tmp/bullet-train-oh-my-zsh-theme-git/*.xz /var/cache/pacman/general/ && \ 195 | rm -r /tmp/* && \ 196 | 197 | # Download and cache fasd 198 | # wget -P /tmp https://aur.archlinux.org/packages/fa/fasd-git/fasd-git.tar.gz && \ 199 | wget -P /tmp https://aur.archlinux.org/cgit/aur.git/snapshot/fasd-git.tar.gz && \ 200 | tar -xvf /tmp/fasd-git.tar.gz -C /tmp && \ 201 | chown -R docker:docker /tmp/fasd-git && \ 202 | runuser -l docker -c "(cd /tmp/fasd-git && makepkg -sc --noconfirm)" && \ 203 | mv /tmp/fasd-git/*.xz /var/cache/pacman/general/ && \ 204 | rm -r /tmp/* && \ 205 | 206 | # Download and cache zsh-dwim-git 207 | # wget -P /tmp https://aur.archlinux.org/packages/zs/zsh-dwim-git/zsh-dwim-git.tar.gz && \ 208 | wget -P /tmp https://aur.archlinux.org/cgit/aur.git/snapshot/zsh-dwim-git.tar.gz && \ 209 | tar -xvf /tmp/zsh-dwim-git.tar.gz -C /tmp && \ 210 | chown -R docker:docker /tmp/zsh-dwim-git && \ 211 | runuser -l docker -c "(cd /tmp/zsh-dwim-git && makepkg -sc --noconfirm)" && \ 212 | mv /tmp/zsh-dwim-git/*.xz /var/cache/pacman/general/ && \ 213 | rm -r /tmp/* && \ 214 | 215 | # Download and cache zaw 216 | # wget -P /tmp https://aur.archlinux.org/packages/za/zaw-git/zaw-git.tar.gz && \ 217 | wget -P /tmp https://aur.archlinux.org/cgit/aur.git/snapshot/zaw-git.tar.gz && \ 218 | tar -xvf /tmp/zaw-git.tar.gz -C /tmp && \ 219 | chown -R docker:docker /tmp/zaw-git && \ 220 | runuser -l docker -c "(cd /tmp/zaw-git && makepkg -sc --noconfirm)" && \ 221 | mv /tmp/zaw-git/*.xz /var/cache/pacman/general/ && \ 222 | rm -r /tmp/* && \ 223 | 224 | # Download and cache sddm-archlinux-theme-git 225 | # wget -P /tmp https://aur.archlinux.org/packages/sd/sddm-archlinux-theme-git/sddm-archlinux-theme-git.tar.gz && \ 226 | wget -P /tmp https://aur.archlinux.org/cgit/aur.git/snapshot/sddm-archlinux-theme-git.tar.gz && \ 227 | tar -xvf /tmp/sddm-archlinux-theme-git.tar.gz -C /tmp && \ 228 | chown -R docker:docker /tmp/sddm-archlinux-theme-git && \ 229 | runuser -l docker -c "(cd /tmp/sddm-archlinux-theme-git && makepkg -sdc --noconfirm)" && \ 230 | mv /tmp/sddm-archlinux-theme-git/*.xz /var/cache/pacman/general/ && \ 231 | rm -r /tmp/* && \ 232 | 233 | # Remove anything we added that we do not need 234 | pacman --noconfirm -Rs dbus-glib dri2proto dri3proto fontsproto glproto \ 235 | libxml2 libxss mesa pixman presentproto randrproto renderproto flex \ 236 | resourceproto videoproto xf86driproto xineramaproto xorg-util-macros \ 237 | gcc binutils guile make libxfont xorg-bdftopcf \ 238 | xorg-font-utils fontconfig libtool m4 git inputproto \ 239 | dbus systemd package-query bison autoconf \ 240 | freetype2 harfbuzz graphite libpng xorg-server-devel \ 241 | gettext && \ 242 | 243 | # Clean up to make this as small as possible 244 | localepurge && \ 245 | 246 | # Remove info, man and docs (only in this container.. not on our new install) 247 | rm -r /usr/share/info/* && \ 248 | rm -r /usr/share/man/* && \ 249 | rm -r /usr/share/doc/* && \ 250 | 251 | # Delete any backup files like /etc/pacman.d/gnupg/pubring.gpg~ 252 | find /. -name "*~" -type f -delete && \ 253 | 254 | # Clean up pacman 255 | bash -c "echo 'y' | pacman -Scc >/dev/null 2>&1" && \ 256 | paccache -rk0 >/dev/null 2>&1 && \ 257 | pacman-optimize && \ 258 | rm -r /var/lib/pacman/sync/* 259 | 260 | ############################################################################### 261 | # Cache packages that have happened since the last airootfs image 262 | # Purposely add another layer here to break up the size. 263 | # Since we kept the one above clean it should add minimal overhead. 264 | ############################################################################### 265 | RUN pacman --noconfirm -Syw --cachedir /var/cache/pacman/general \ 266 | btrfs-progs \ 267 | ca-certificates-utils \ 268 | ca-certificates \ 269 | dnsmasq \ 270 | glib2 \ 271 | glibc \ 272 | gnupg \ 273 | gnutls \ 274 | grml-zsh-config \ 275 | gssproxy \ 276 | lftp \ 277 | libinput \ 278 | libssh2 \ 279 | libsystemd \ 280 | libtasn1 \ 281 | lz4 \ 282 | man-pages \ 283 | nano \ 284 | nettle \ 285 | ntp \ 286 | partclone \ 287 | openconnect \ 288 | systemd-sysvcompat \ 289 | tcpdump \ 290 | testdisk && \ 291 | rm -r /var/lib/pacman/sync/* 292 | 293 | ############################################################################### 294 | # Just download these since we don't actually need them for the docker container. 295 | # Make sure none of these are in the list above. 296 | # Broke into two layers for better download speeds on the container. 297 | ############################################################################### 298 | 299 | RUN pacman --noconfirm -Syw --cachedir /var/cache/pacman/general \ 300 | base-devel \ 301 | acpi \ 302 | alsa-utils \ 303 | arch-install-scripts \ 304 | aria2 \ 305 | c-ares \ 306 | cpupower \ 307 | ctags \ 308 | dkms \ 309 | feh \ 310 | git \ 311 | haveged \ 312 | htop \ 313 | gnome-keyring \ 314 | gnome-terminal \ 315 | google-chrome \ 316 | linux \ 317 | linux-headers \ 318 | hfsprogs \ 319 | intel-ucode \ 320 | imagemagick \ 321 | lm_sensors \ 322 | mlocate \ 323 | networkmanager \ 324 | network-manager-applet \ 325 | pavucontrol \ 326 | package-query \ 327 | pciutils \ 328 | powertop \ 329 | pulseaudio-alsa \ 330 | pulseaudio && \ 331 | 332 | # Clean up pacman 333 | rm -r /var/lib/pacman/sync/* 334 | 335 | RUN pacman --noconfirm -Syw --cachedir /var/cache/pacman/general \ 336 | libical \ 337 | solid \ 338 | gamin \ 339 | bluez \ 340 | plasma \ 341 | konsole \ 342 | python-dateutil \ 343 | python-docutils \ 344 | python-pyasn1\ 345 | python-rsa \ 346 | python-setuptools \ 347 | python-six \ 348 | reflector \ 349 | rsync \ 350 | sqlite \ 351 | sddm \ 352 | systemd \ 353 | terminus-font \ 354 | tree \ 355 | tmux \ 356 | vim \ 357 | xfce4 \ 358 | xfce4-whiskermenu-plugin \ 359 | xorg-server \ 360 | xorg-server-utils \ 361 | xorg-xinit \ 362 | xorg-xev \ 363 | yajl \ 364 | yaourt \ 365 | zsh-syntax-highlighting && \ 366 | 367 | # Clean up pacman 368 | rm -r /var/lib/pacman/sync/* 369 | 370 | 371 | # # Download and cache Infinality Fonts 372 | # RUN bash -c "echo \"[infinality-bundle-fonts]\" >> /etc/pacman.conf" && \ 373 | # bash -c "echo \"Server = http://bohoomil.com/repo/fonts \" >>/etc/pacman.conf" && \ 374 | # bash -c "echo \"SigLevel = Never\" >> /etc/pacman.conf" && \ 375 | 376 | # bash -c "echo \"[infinality-bundle]\" >> /etc/pacman.conf" && \ 377 | # bash -c "echo \"Server = http://bohoomil.com/repo/x86_64 \" >>/etc/pacman.conf" && \ 378 | # bash -c "echo \"SigLevel = Never\" >> /etc/pacman.conf" && \ 379 | 380 | # rm /var/cache/pacman/general/ttf-dejavu-* && \ 381 | # rm /var/cache/pacman/general/freetype2-* && \ 382 | # rm /var/cache/pacman/general/fontconfig-* && \ 383 | # rm /var/cache/pacman/general/cairo-* && \ 384 | # rm /var/cache/pacman/general/cantarell-fonts-* && \ 385 | 386 | # pacman --noconfirm -Syw --cachedir /var/cache/pacman/general \ 387 | # infinality-bundle \ 388 | # ibfonts-meta-base \ 389 | # otf-cantarell-ib \ 390 | # ibfonts-meta-extended-lt \ 391 | # otf-oswald-ib \ 392 | # otf-quintessential-ib \ 393 | # otf-tex-gyre-ib \ 394 | # t1-cursor-ib \ 395 | # t1-urw-fonts-ib \ 396 | # ttf-caladea-ib \ 397 | # ttf-cantoraone-ib \ 398 | # ttf-carlito-ib \ 399 | # ttf-ddc-uchen-ib \ 400 | # ttf-droid-ib \ 401 | # ttf-gelasio-ib \ 402 | # ttf-lohit-odia-ib \ 403 | # ttf-lohit-punjabi-ib \ 404 | # ttf-merriweather-ib \ 405 | # ttf-merriweather-sans-ib \ 406 | # # ttf-noto-serif-multilang-ib \ 407 | # ttf-opensans-ib \ 408 | # ttf-signika-family-ib \ 409 | # ttf-ubuntu-font-family-ib && \ 410 | 411 | # # Clean up pacman 412 | # rm -r /var/lib/pacman/sync/* 413 | 414 | CMD /bin/zsh 415 | 416 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Jonathan Yantis 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Instant Arch Linux on Macs & MacBooks [deprecated, help welcome] 2 | 3 | NB: This project is currently not being actively maintained, and is not usable at this moment. PRs are still very welcome in order to fix the current usability issues. 4 | 5 | This will setup Arch Linux on your Mac or MacBook all from Mac OSX. No need for any USB drives or figuring out the proper network/video drivers to get your 6 | system to get up. It should install without any rebooting etc. Just launch it and enter your password twice and go about your business. 7 | 8 | Warning: Backup your stuff or use a fresh iMac or MacBook. There are no guarantees this will work and it might leave your machine in an unusable 9 | state. I personally didn't worry about this to much as one can just reset it back to a [factory restore] 10 | (https://github.com/yantis/instant-archlinux-on-mac/blob/master/factory-restore.md) with "⌘ + R" at startup 11 | or "option + ⌘ + R for [internet recovery](https://github.com/yantis/instant-archlinux-on-mac/blob/master/factory-restore.md). 12 | 13 | That being said. It has been designed to not write anything in case of failure. So worst case if it doesn't work you will probably be OK. 14 | Though seriously back up anything you actually want to be safe. 15 | 16 | Will this work with your iMac or MacBook? Possibly. It worked with all the ones I tested it with. I suspect it will most likely work and even if not perfect 17 | you will be in a much better place than trying to do it by hand. I do know for a fact that I haven't set it up to work with fusion drives yet 18 | so if your drive is a fusion drive it won't work without some minor changes. 19 | 20 | If you have any problems feel free to shoot me an email at yantis@yantis.net 21 | 22 | ## Features 23 | * Installs without USB. 24 | * Installs without needing network drivers. 25 | * Installs without needing video drivers. 26 | * Installs 100% in Mac OSX with no rebooting neeed. 27 | * When you do choose to use Arch Linux it should be 100% usable by simply rebooting. 28 | * Very quick install. If your bandwidth is fast enough the whole install takes under 10 minutes. 29 | * Easy to remove and revert back to normal. 30 | 31 | ## Installed Programs 32 | * rEFInd with rEFInd minimal theme. 33 | * KDE Plasma, XCFE4, and Awesome window desktop managers. 34 | * SDDM with Archlinux Theme 35 | * Infinality Fonts preconfigured and installed. 36 | * Latest Intel, Nvidia, and AMD/ATI Radeon drivers (DKMS) 37 | * Network Drivers and Broadcom firmware preinstalled and setup. 38 | * Network manager and applets setup for lan or wifi use. 39 | * Powerline with Powerline fonts installed 40 | * ZSH, Oh-my-zsh, tmux, vim preinstalled. 41 | * Google Chrome 42 | * Sound system preconfigured (Alsa/Pulseaudio) 43 | * Mac OSX Drive is shared read only 44 | * Development Tools plus python2, python3, & ruby. 45 | * Thermald and cpupower 46 | * Mac Fan control daemon 47 | * Terminals: xfce4-terminal, konsole, gnome-terminal, vte3 48 | * xf86-input-mtrack package installed and configured. 49 | * Yaourt for AUR 50 | 51 | ## Tested Working 52 | * Mountain Lion, Lion, Yosemite, El Capitan, and Sierra 53 | * [MacBookPro10,1] - MacBook Pro (Retina, Mid 2012) 54 | * [MacBookPro10,2] - MacBook Pro (Retina, 13-inch, Late 2012) 55 | * [iMac15,1] - iMac Retina 2014 56 | 57 | ## Tested not working but in progress 58 | * [MacBook8,1] - MacBook 12" Oct 29th, 2016 Update - Still no working keyboard 59 | though fully working if I install a usb hub, keyboard, mouse and usb ethernet 60 | 61 | # Setup 62 | * If the OS is El Capitan then you need to disable System Integrity Protection by rebooting and at the chime hiting command+R and opening a terminal and typing: csrutil disable; reboot 63 | * Make sure FileVault encryption is [turned off](https://support.apple.com/kb/PH18674?locale=en_US). If it isn't you need to disable it and reboot. 64 | * Use ⌘ + space to open spotlight. Type in terminal and hit return. 65 | * Optionally, update your software either through the terminal or App store Though if you do you may have to reboot though probably not. 66 | This step can take a while on a new machine. It usually is a 2+ GB download. You simply might want to use the GUI update application to have some indication of progress. 67 | 68 | ``` 69 | sudo softwareupdate -i -a 70 | ``` 71 | 72 | If you wanted your Mac to have 100GB and Arch Linux to have the rest type this: 73 | 74 | ``` 75 | curl -O https://raw.githubusercontent.com/yantis/instant-archlinux-on-mac/master/mac-install.sh && mac-install.sh 100 76 | ``` 77 | 78 | Same as above but using Google's URL shortener: 79 | 80 | ``` 81 | curl -OL goo.gl/VdgxPO && sh VdgxPO 100 82 | ``` 83 | 84 | There is a USB option but I haven't figured out the booting on that yet. So that is a work in progress but to 85 | do that type: 86 | 87 | ``` 88 | curl -O https://raw.githubusercontent.com/yantis/instant-archlinux-on-mac/master/mac-install.sh && mac-install.sh USB 89 | ``` 90 | 91 | # Breakdown (Behind the scenes) 92 | * Command Line Developer tools, Homebrew, VirtualBox, Boot2docker, Docker all get silently and automatically installed. 93 | * Since Mac OSX doesn't support the Ext4 file system. We install a 10 day trial of Paragon ExtFS (It can be uninstalled after the install) 94 | * The file system gets converted to HFS+ if needed then volume gets shrunk down to make room for Arch Linux. 95 | * The physical volume gets mapped to virtual volumes for VirtualBox. 96 | * The system is profiled to be able to dynamically adapt to its hardware. 97 | * Boot2docker launches VirtualBox with our physical volumes mapped. 98 | * A [docker container](https://registry.hub.docker.com/u/yantis/instant-archlinux-on-mac) gets launched which then downloads 99 | this [script](https://github.com/yantis/instant-archlinux-on-mac/blob/master/mac-install-internal.sh) to dynamically setup Arch Linux. 100 | * It unsquashes a [rootfs image](http://mirror.rackspace.com/archlinux/iso/2015.04.01/arch/x86_64/) into a chroot environment. 101 | * Everything gets installed and setup in that chroot environment. 102 | * Once completed everything in that chroot environment gets rsynced over to the virtual mapped physical drive. 103 | * rEFInd is installed for dual booting Mac OSX & Linux As well as a very sexy [rEFInd Minimal Theme](https://github.com/EvanPurkhiser/rEFInd-minimal) 104 | * Nothing actually gets written unless everything is successful. 105 | 106 | 107 | # Issues 108 | * When booting up there is now a small but noticable delay of around 30 seconds. This has something to do with rEFInd and should be fixable. 109 | 110 | # Troubleshooting 111 | 112 | The defaults for an HFS+ file system look like this. This script expects your "Macintosh HD" to be at disk0s2. 113 | 114 | ``` 115 | $ diskutil list 116 | 117 | /dev/disk0 118 | #: TYPE NAME SIZE IDENTIFIER 119 | 0: GUID_partition_scheme *500.3 GB disk0 120 | 1: EFI EFI 209.7 MB disk0s1 121 | 2: Apple_HFS Macintosh HD 499.4 GB disk0s2 122 | 3: Apple_Boot Recovery HD 650.0 MB disk0s3 123 | ``` 124 | 125 | The defaults for Core Storage look like this. This script expects "Apple_CoreStorage" to be at disk0s2. 126 | 127 | ``` 128 | $ diskutil list 129 | 130 | /dev/disk0 131 | #: TYPE NAME SIZE IDENTIFIER 132 | 0: GUID_partition_scheme *500.3 GB disk0 133 | 1: EFI EFI 209.7 MB disk0s1 134 | 2: Apple_CoreStorage 499.4 GB disk0s2 135 | 3: Apple_Boot Recovery HD 650.0 MB disk0s3 136 | 137 | /dev/disk1 138 | #: TYPE NAME SIZE IDENTIFIER 139 | 0: Apple_HFS Macintosh HD *499.0 GB disk1 140 | Logical Volume on disk0s2 141 | C3E9416F-A8DF-4E50-9BEE-87B2C538689E 142 | Unencrypted 143 | ``` 144 | 145 | * Make sure that FireVault is [turned off](https://support.apple.com/kb/PH18674?locale=en_US) 146 | * If the script doesn't remove Core Storage for you. You can try the trick of enabling FileVault, rebooting, disabling it and rebooting. Which should remove Core Storage. 147 | * Fusion drives do not work yet as it hasn't been programmed in yet. 148 | * Make sure to leave at least 30GB for Mac OSX (or at least whatever the drive space is plus a few GB for updates). 149 | * If you want to mess with a minimal install of Archlinux. It runs perfectly fine on 10GB or less of space. 150 | * This hasn't been tested with bootcamp but I suspect it will not work as is. 151 | * If for some reason on boot you get no disk found select linux and hit F2 and select "Fallback with Micokernel updates" and run as root "mkinitcpio -p linux" to regenerate the initramfs and reboot 152 | 153 | # References & Resources 154 | 155 | #### Mac on Archlinux 156 | * https://wiki.gentoo.org/wiki/Apple_Macbook_Pro_Retina 157 | * http://loicpefferkorn.net/2015/01/arch-linux-on-macbook-pro-retina-2014-with-dm-crypt-lvm-and-suspend-to-disk/ 158 | * https://wiki.archlinux.org/index.php/MacBook 159 | * https://bbs.archlinux.org/viewtopic.php?id=195924 160 | * https://github.com/pandeiro/arch-on-air 161 | * https://github.com/jantman/puppet-archlinux-macbookretina 162 | * https://wiki.debian.org/iMacIntel 163 | * https://github.com/coldnew/macbookair-2013-config/blob/master/kernel-config.example 164 | * https://github.com/NapoleonWils0n/cerberus/ 165 | * https://github.com/gammy/macbook8-1_archlinux 166 | * https://wiki.archlinux.org/index.php/MacBook 167 | * http://loicpefferkorn.net/2015/01/arch-linux-on-macbook-pro-retina-2014-with-dm-crypt-lvm-and-suspend-to-disk/ 168 | * https://medium.com/@PhilPlckthun/arch-linux-running-on-my-macbook-2ea525ebefe3 169 | * https://help.ubuntu.com/community/MacBookPro11-1/utopic 170 | * https://github.com/jantman/puppet-archlinux-macbookretina 171 | * http://www.nixknight.com/2014/02/arch-linux-installation-with-kde-desktop/ 172 | * http://codylittlewood.com/arch-linux-on-macbook-pro-installation/ 173 | * https://aur.archlinux.org/packages/linux-macbook-pro 174 | 175 | #### Creating/Resizing of MacOS drives 176 | * http://apple.stackexchange.com/questions/63130/create-new-partition-in-unallocated-space-with-diskutil 177 | * https://github.com/cowboy/dotfiles/blob/master/bin/osx_hide_partition 178 | * http://en.wikipedia.org/wiki/GUID_Partition_Table 179 | 180 | #### Homebrew 181 | * http://brew.sh/ 182 | 183 | #### Docker 184 | * http://blog.javabien.net/2014/03/03/setup-docker-on-osx-the-no-brainer-way/ 185 | * http://viget.com/extend/how-to-use-docker-on-os-x-the-missing-guide 186 | 187 | #### EXT4 188 | * https://github.com/carlcarl/blog/blob/cacca2e50fe4fbcca2e9c3d68bad9176a66f8016/content/archive/osx_mavericks_ext4.md 189 | * http://download.paragon-software.com/doc/Manual_extfsmac_eng.pdf 190 | * http://www.paragon-software.com/home/extfs-mac/download.html 191 | * https://jamfnation.jamfsoftware.com/discussion.html?id=12843 192 | * http://tips.jay.cat/ext4-support-in-osx-yosemite/ 193 | 194 | #### EFI 195 | * http://www.rodsbooks.com/refind/installing.html#wde 196 | 197 | #### VirtualBox 198 | * https://wiki.archlinux.org/index.php/VirtualBox 199 | 200 | #### SquashFS 201 | * http://askubuntu.com/questions/95392/how-to-create-a-bootable-system-with-a-squashfs-root 202 | 203 | #### Macbook Retina 12" 2015 (Macbook 8,1) 204 | * https://github.com/SicVolo/hid-apple-4.1.2 205 | * https://bugzilla.kernel.org/show_bug.cgi?id=96771 206 | * https://forums.opensuse.org/showthread.php/507933-openSUSE-on-the-2015-Apple-12-Inch-Retina-MacBook/page2 207 | * https://en.wiki2.org/wiki/NVM_Express 208 | * http://www.nvmexpress.org/resources/linux-driver-information/ 209 | * http://www.anandtech.com/show/9136/the-2015-macbook-review/8 210 | * http://ubuntuforums.org/showthread.php?t=2283423 211 | * https://bbs.archlinux.org/viewtopic.php?id=198051 212 | * https://bugzilla.kernel.org/show_bug.cgi?id=99891 213 | * https://bugzilla.kernel.org/show_bug.cgi?id=110901 214 | * https://forums.opensuse.org/showthread.php/507933-openSUSE-on-the-2015-Apple-12-Inch-Retina-MacBook/page5 215 | * https://www.bountysource.com/issues/35422234-macbook8-1-12-inch-early-2015-keyboard-and-trackpad-don-t-work 216 | * https://bugzilla.kernel.org/show_bug.cgi?id=108331 217 | 218 | #### Macbook Retina 12" 2016 219 | * https://github.com/cb22/macbook12-spi-driver/ 220 | 221 | 222 | #### El Capitan 223 | * http://osxdaily.com/2015/10/05/disable-rootless-system-integrity-protection-mac-os-x/ 224 | 225 | [Github Pages](http://yantis.github.io/instant-archlinux-on-mac/) 226 | -------------------------------------------------------------------------------- /buildme.sh: -------------------------------------------------------------------------------- 1 | docker build -t yantis/instant-archlinux-on-mac . 2 | # docker run -ti --rm yantis/-instant-archlinux-on-mac 3 | -------------------------------------------------------------------------------- /docker-build-mac.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #============================================================================== 4 | #============================================================================== 5 | # Copyright (c) 2015 Jonathan Yantis 6 | # yantis@yantis.net 7 | # Released under the MIT license 8 | #============================================================================== 9 | #============================================================================== 10 | 11 | ############################################################################### 12 | # Exit on any error whatsoever 13 | # You should be able to just rerun the script at any point and it should 14 | # recover where it left off from. 15 | ############################################################################### 16 | set -e 17 | set -u 18 | 19 | ############################################################################### 20 | # Install homebrew 21 | ############################################################################### 22 | if ! hash brew 2> /dev/null; then 23 | ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" /dev/null; then 39 | echo "*** Installing VirtualBox ***" 40 | 41 | # curl -OL http://download.virtualbox.org/virtualbox/5.1.8/VirtualBox-5.1.8-111374-OSX.dmg 42 | curl -OL http://download.virtualbox.org/virtualbox/5.1.14/VirtualBox-5.1.14-112924-OSX.dmg 43 | 44 | # hdiutil mount VirtualBox-5.1.8-111374-OSX.dmg 45 | hdiutil mount VirtualBox-5.1.14-112924-OSX.dmg 46 | 47 | sudo installer -pkg /Volumes/VirtualBox/VirtualBox.pkg -target / 48 | sleep 2 49 | hdiutil unmount /Volumes/VirtualBox/ 50 | # rm VirtualBox-5.0.24-108355-OSX.dmg 51 | fi 52 | 53 | ############################################################################### 54 | # Install docker-machine 55 | ############################################################################### 56 | if ! hash docker-machine 2> /dev/null; then 57 | echo "*** Installing Docker Machine***" 58 | if ! brew install docker-machine; then 59 | echo "Xcode 8.1 error most likely. Sadly for now you need to get this from developer.apple.com and install by hand " 60 | exit 1 61 | # echo "Xcode 8.1 error most likely so installing from the source site" 62 | # curl -L https://github.com/docker/machine/releases/download/v0.8.2/docker-machine-`uname -s`-`uname -m` >/usr/local/bin/docker-machine 63 | # chmod +x /usr/local/bin/docker-machine 64 | fi 65 | fi 66 | 67 | ############################################################################### 68 | echo "Initialize docker-machine" 69 | ############################################################################### 70 | if ! docker-machine status docker-vm 2> /dev/null; then 71 | echo "*** Initialize docker-machine ***" 72 | docker-machine create --driver virtualbox docker-vm 73 | fi 74 | 75 | ############################################################################### 76 | # Install Docker 77 | ############################################################################### 78 | if ! hash docker 2> /dev/null; then 79 | echo "Installing docker" 80 | if ! brew install docker; then 81 | echo "Xcode 8.1 error most likely. Sadly for now you need to get this from developer.apple.com and install by hand " 82 | exit 1 83 | fi 84 | fi 85 | 86 | 87 | ############################################################################### 88 | # Install boot2docker 89 | ############################################################################### 90 | if ! hash boot2docker 2> /dev/null; then 91 | echo "Installing boot2docker" 92 | if ! brew install boot2docker; then 93 | echo "Xcode 8.1 error most likely. Sadly for now you need to get this from developer.apple.com and install by hand " 94 | exit 1 95 | fi 96 | fi 97 | 98 | ############################################################################### 99 | echo "Get Boot2Docker exports" 100 | docker-machine regenerate-certs docker-vm --force 101 | eval "$(docker-machine env docker-vm)" 102 | ############################################################################### 103 | 104 | ############################################################################### 105 | # Download the rootfs 106 | ############################################################################### 107 | if [ ! -f ~/airootfs.sfs ]; 108 | then 109 | echo "Downloading rootfs image" 110 | cd ~ 111 | # curl -OL http://mirror.rackspace.com/archlinux/iso/2016.10.01/arch/x86_64/airootfs.sfs 112 | curl -OL http://mirror.rackspace.com/archlinux/iso/2017.08.01/arch/x86_64/airootfs.sfs 113 | fi 114 | 115 | ############################################################################### 116 | # Build the docker container 117 | ############################################################################### 118 | docker build -t yantis/instant-archlinux-on-mac . 119 | 120 | ############################################################################### 121 | # Restore security 122 | ############################################################################### 123 | sudo chmod 660 /dev/${ROOTDISK}s1 124 | sudo sed -i.bak "s/Defaults timestamp_timeout=-1/#Defaults timestamp_timeout=-1/" /etc/sudoers 125 | 126 | ############################################################################### 127 | # All Done 128 | ############################################################################### 129 | 130 | # vim:set ts=2 sw=2 et: 131 | -------------------------------------------------------------------------------- /factory-restore.md: -------------------------------------------------------------------------------- 1 | ### Factory restore 2 | 3 | * ⌘ + R for factory restore. (and hit the power button) 4 | * Providing you still have your recovery partition it will use the latest OS you have installed (ie: Yosimite) 5 | * When install OS X Yosemite appears click continue. 6 | * Agree to the terms of service and install the OS on your selected drive and go. 7 | 8 | ### Internet recovery 9 | 10 | * option + ⌘ + R for internet recovery. (and hit the power button) 11 | * This will install the OS that you bought the machine with. 12 | * Click Disk Utility and click continue 13 | * Click Macintosh HD 14 | * Click Partition 15 | * For each volume 16 | - click unmount 17 | - click the - sign 18 | - click remove to delete them. 19 | - if they do not delete you may have to erase them first (I had this happen with an ext4 volume) 20 | * At this point you should have no volumes whatsoever 21 | * Create a new volume by clicking on the + and set the name to "Macintosh HD" then click apply then click partition. 22 | * exit Disk Utility 23 | * Click Reinstall OS X and click "continue". Depending on your OS is you might another one like Mountain Lion or Lion and may need to do this step 24 | then install Yosemite once you get back into the system. 25 | -------------------------------------------------------------------------------- /initial_configuration.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #============================================================================== 4 | #============================================================================== 5 | # Copyright (c) 2015 Jonathan Yantis 6 | # yantis@yantis.net 7 | # Released under the MIT license 8 | #============================================================================== 9 | #============================================================================== 10 | 11 | ############################################################################### 12 | # Change this to your timezone 13 | ############################################################################### 14 | timedatectl set-timezone America/Los_Angeles 15 | 16 | ############################################################################### 17 | # Import any public keys that we need and initalize 18 | # For some reason this wouldn't stick in the docker container. 19 | ############################################################################### 20 | pacman-key --init 21 | 22 | # Import infinality repo key 23 | pacman-key -a /var/cache/keys/962DDE58.pub 24 | pacman-key --lsign 962DDE58 25 | 26 | ############################################################################### 27 | # Set the keyboard LEDs to light up 28 | # change this to 0 or your desired brightness level 29 | ############################################################################### 30 | echo "255" > /sys/class/leds/smc::kbd_backlight/brightness 31 | 32 | ############################################################################### 33 | # Set this to your desired cpu power mode. 34 | ############################################################################### 35 | if hash cpupower 2> /dev/null; then 36 | # cpupower frequency-set -g performance 37 | cpupower frequency-set -g powersave 38 | fi 39 | 40 | ############################################################################### 41 | # NVIDIA 42 | # If the machine has an nvidia card then run nvidia-xconfig on it 43 | ############################################################################### 44 | if hash nvidia-xconfig 2> /dev/null; then 45 | nvidia-xconfig \ 46 | --add-argb-glx-visuals \ 47 | --allow-glx-with-composite \ 48 | --composite \ 49 | -no-logo \ 50 | --render-accel \ 51 | -o /usr/share/X11/xorg.conf.d/20-nvidia.conf 52 | fi 53 | 54 | ############################################################################### 55 | # AMD/ATI 56 | # If the machine has an AMD/ATI card then run aticonfig on it 57 | ############################################################################### 58 | if hash aticonfig 2> /dev/null; then 59 | aticonfig \ 60 | --initial \ 61 | --output /usr/share/X11/xorg.conf.d/20-radeon.conf 62 | 63 | # Import catalyst repo key 64 | pacman-key -a /var/cache/keys/653C3094.pub 65 | pacman-key --lsign 653C3094 66 | 67 | fi 68 | 69 | ############################################################################### 70 | # Setup Sound 71 | # By default ALSA has all channels muted. Those have to be unmuted manually 72 | ############################################################################### 73 | amixer sset Master unmute 74 | 75 | ############################################################################### 76 | # Cleanup 77 | # This is supposed to delete us but it still is around as I see a fragment in the journal 78 | ############################################################################### 79 | systemctl disable initial_configuration.service 80 | rm /usr/lib/systemd/system/initial_configuration.service 81 | rm $0 82 | -------------------------------------------------------------------------------- /mac-install-internal.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #============================================================================== 4 | #============================================================================== 5 | # Copyright (c) 2015-2016 Jonathan Yantis 6 | # yantis@yantis.net 7 | # Released under the MIT license 8 | #============================================================================== 9 | #============================================================================== 10 | 11 | ############################################################################### 12 | # Exit on any error whatsoever 13 | # since we don't actually modify the physical drive until the very end 14 | ############################################################################### 15 | set -e -u -o pipefail 16 | 17 | ############################################################################### 18 | # Get the model of this Mac/Macbook 19 | ############################################################################### 20 | MODEL=$(grep "Model Identifier" /systeminfo | awk '{print $3}') 21 | echo "" 22 | echo "Mac Model: $MODEL" 23 | 24 | ############################################################################### 25 | # Get the initial configuration file. Moved from inside the docker container 26 | # To a URL so the user can change it to thier liking. 27 | ############################################################################### 28 | wget -O /root/initial_configuration.sh \ 29 | https://raw.githubusercontent.com/yantis/instant-archlinux-on-mac/master/initial_configuration.sh 30 | 31 | ############################################################################### 32 | # A lot of this complexity is because of the error: 33 | # mount: unknown filesystem type 'devtmpfs' 34 | # Which only happens in docker container but not in a virtual machine. 35 | # It would have been very nice to simply use pacstrap =( 36 | ############################################################################### 37 | mkdir /arch 38 | unsquashfs -d /squashfs-root /root/airootfs.sfs 39 | ls /squashfs-root 40 | 41 | # ls /root 42 | # mount -o loop /squashfs-root/airootfs.img /arch 43 | # mount -o loop -t squash/squashfs-root /arch 44 | # mv /squashfs-root /arch 45 | mount --bind /squashfs-root /arch 46 | mount --bind /dev /arch/dev 47 | ls /arch/boot 48 | chroot /arch ls /boot 49 | chroot /arch mount -t proc none /proc 50 | chroot /arch mount -t sysfs none /sys 51 | chroot /arch mount -t devpts none /dev/pts 52 | 53 | # bind /proc /arch/proc 54 | # mount -o bind /sys /arch/sys 55 | # mount -o bind /dev /arch/dev 56 | 57 | # mount -t proc none /arch/proc 58 | # mount -t sysfs none /arch/sys 59 | # mount -o bind /dev /arch/dev 60 | 61 | # Important for pacman (for signature check) 62 | # (Doesn't seem to matter at all they are still messed up.) 63 | # mount -o bind /dev/pts /arch/dev/pts 64 | 65 | ############################################################################### 66 | # Use Google's nameservers though I believe we may be able to simply copy the 67 | # /etc/resolv.conf over since Docker magages that and it "should" be accurate. 68 | ############################################################################### 69 | echo "nameserver 8.8.8.8" >> /etc/resolv.conf 70 | echo "nameserver 8.8.8.4" >> /etc/resolv.conf 71 | cp /etc/resolv.conf /arch/etc/resolv.conf 72 | 73 | # chroot /arch export HOME=/dev/root 74 | # chroot /arch export LC_ALL=C 75 | ############################################################################### 76 | # Generate entropy 77 | ############################################################################### 78 | chroot /arch haveged 79 | 80 | ############################################################################### 81 | # Init pacman 82 | ############################################################################### 83 | # Fix for failed: IPC connect call failed 84 | 85 | echo "*** Checking network ***" 86 | chroot /arch ping -c2 8.8.8.8 87 | 88 | echo "*** Launching dirmngr ***" 89 | chroot /arch bash -c "dirmngr /dev/null 2>&1" 90 | 91 | echo "*** pacman-key Init ***" 92 | if ! chroot /arch pacman-key --init; then 93 | echo "pacman-key init failure. Trying to continue anyway" 94 | fi 95 | 96 | echo "*** pacman-key populate ***" 97 | if ! chroot /arch pacman-key --populate; then 98 | echo "pacman-key init failure. Trying to continue anyway" 99 | fi 100 | 101 | ############################################################################### 102 | # Temp bypass sigchecks because of 103 | # GPGME error: Inapproropriate ioctrl for device 104 | # It has something to do with the /dev/pts in a chroot but I didn't have any 105 | # luck solving it. 106 | # https://bbs.archlinux.org/viewtopic.php?id=130538 107 | ############################################################################### 108 | sed -i "s/\[core\]/\[core\]\nSigLevel = Never/" /arch/etc/pacman.conf 109 | sed -i "s/\[extra\]/\[extra\]\nSigLevel = Never/" /arch/etc/pacman.conf 110 | sed -i "s/\[community\]/\[community\]\nSigLevel = Never/" /arch/etc/pacman.conf 111 | 112 | ############################################################################### 113 | # Enable multilib repo 114 | ############################################################################### 115 | sed -i '/#\[multilib\]/,/#Include = \/etc\/pacman.d\/mirrorlist/ s/#//' /arch/etc/pacman.conf 116 | sed -i '/#\[multilib\]/,/#Include = \/etc\/pacman.d\/mirrorlist/ s/#//' /arch/etc/pacman.conf 117 | sed -i 's/#\[multilib\]/\[multilib\]/g' /arch/etc/pacman.conf 118 | 119 | ############################################################################### 120 | # Enable Infinality Fonts Repo 121 | # Temp disable signature checking. But restore at the end. 122 | # because of GPGME error: Inapproropriate ioctrl for device 123 | ############################################################################### 124 | # echo "[infinality-bundle-fonts]" >> /arch/etc/pacman.conf 125 | # echo "Server = http://bohoomil.com/repo/fonts" >>/arch/etc/pacman.conf 126 | # echo "SigLevel = Never" >> /arch/etc/pacman.conf 127 | 128 | # echo "[infinality-bundle]" >> /arch/etc/pacman.conf 129 | # echo "Server = http://bohoomil.com/repo/x86_64" >>/arch/etc/pacman.conf 130 | # echo "SigLevel = Never" >> /arch/etc/pacman.conf 131 | 132 | # echo "[infinality-bundle-multilib]" >> /arch/etc/pacman.conf 133 | # echo "Server = http://bohoomil.com/repo/multilib/x86_64" >> /arch/etc/pacman.conf 134 | # echo "SigLevel = Never" >> /arch/etc/pacman.conf 135 | 136 | # chroot /arch pacman-key -r 962DDE58 # --keyserver hkp://subkeys.pgp.net 137 | # chroot /arch pacman-key --lsign 962DDE58 138 | 139 | # For whatever reason when the system comes back up it won't remember these keys. 140 | # So lets cache them and import them on first run. 141 | # chroot /arch mkdir -p /var/cache/keys 142 | # chroot /arch bash -c "pacman-key -e 962DDE58 > /var/cache/keys/962DDE58.pub" 143 | 144 | ############################################################################### 145 | # Allow for colored output in pacman.conf 146 | ############################################################################### 147 | sed -i "s/#Color/Color/" /arch/etc/pacman.conf 148 | 149 | ############################################################################### 150 | # For now only uses mirrors.kernel.org as that is the most trusted mirror. 151 | # So we do not run into a malicious mirror. 152 | # Will run reflector towards the end of the script. 153 | ############################################################################### 154 | echo "Server = http://mirrors.kernel.org/archlinux/\$repo/os/\$arch" > /arch/etc/pacman.d/mirrorlist 155 | 156 | ############################################################################### 157 | # Copy over general & custom cached packages 158 | # Moved the packages to the docker container as I know the docker container 159 | # downloads trusted packages and it should be being build by a third party 160 | # (docker hub) plus it avoids hammering the mirrors while working on this. 161 | # Plus it makes the install extremely fast. 162 | ############################################################################### 163 | mkdir -p /arch/var/cache/pacman/general/ 164 | 165 | # Remove any development packages. 166 | # rm /var/cache/pacman/general/*devel* 167 | # # rm /var/cache/pacman/general/*-dev-* 168 | 169 | cp /var/cache/pacman/general/* /arch/var/cache/pacman/general/ 170 | 171 | mkdir -p /arch/var/cache/pacman/custom/ 172 | cp /var/cache/pacman/custom/* /arch/var/cache/pacman/custom/ 173 | 174 | ############################################################################### 175 | echo "** Syncing pacman database & Update **" 176 | ############################################################################### 177 | chroot /arch pacman -Syyu --noconfirm 178 | 179 | ############################################################################### 180 | # Have pacman use aria2 for downloads and give it extreme patience 181 | # This is mostly to keep the script from breaking on pacman timeout errors. 182 | ############################################################################### 183 | # chroot /arch bash -c "(cd /var/cache/pacman/general && yes | pacman --noconfirm -U sqlite* aria2* c-ares*)" 184 | # echo "XferCommand = /usr/bin/printf 'Downloading ' && echo %u | awk -F/ '{printf \$NF}' && printf '...' && /usr/bin/aria2c -m0 -q --allow-overwrite=true -c --file-allocation=falloc --log-level=error --max-connection-per-server=2 --max-file-not-found=99 --min-split-size=5M --no-conf --remote-time=true --summary-interval=0 -t600 -d / -o %o %u && echo ' Complete!'" >> /etc/pacman.conf 185 | 186 | ############################################################################### 187 | echo "Installing cached general packages" 188 | ############################################################################### 189 | # chroot /arch pacman --noconfirm --needed -U /var/cache/pacman/general/package-quer*.pkg.tar.xz 190 | # chroot /arch pacman --noconfirm --needed -U /var/cache/pacman/general/package-quer*.pkg.tar.xz 191 | chroot /arch pacman --noconfirm --needed -U /var/cache/pacman/general/*.pkg.tar.xz 192 | 193 | ############################################################################### 194 | # update after pushing packages from docker container to get the system 195 | # in the most up to date state. 196 | ############################################################################### 197 | 198 | echo "** Updating System **" 199 | chroot /arch pacman -Syyu --noconfirm 200 | 201 | 202 | ############################################################################### 203 | # Setup Infinality Fonts 204 | # Moved to DOCKERFILE 205 | ############################################################################### 206 | # chroot /arch pacman --noconfirm -Rdd freetype2 cairo fontconfig 207 | # chroot /arch pacman --noconfirm --needed -S infinality-bundle 208 | # # chroot /arch pacman --noconfirm --needed -S infinality-bundle-multilib 209 | 210 | # # Instal fonts 211 | # chroot /arch pacman --noconfirm -Rdd ttf-dejavu 212 | # chroot /arch pacman --noconfirm --needed -S ibfonts-meta-base 213 | 214 | # # Install ibfonts-meta-extended without the international fonts 215 | # # If you want international its "ibfonts-meta-extended" 216 | # chroot /arch pacman --noconfirm -Rdd cantarell-fonts 217 | # chroot /arch pacman --noconfirm --needed -S \ 218 | # otf-cantarell-ib \ 219 | # ibfonts-meta-extended-lt \ 220 | # otf-oswald-ib \ 221 | # otf-quintessential-ib \ 222 | # otf-tex-gyre-ib \ 223 | # t1-cursor-ib \ 224 | # t1-urw-fonts-ib \ 225 | # ttf-caladea-ib \ 226 | # ttf-cantoraone-ib \ 227 | # ttf-carlito-ib \ 228 | # ttf-ddc-uchen-ib \ 229 | # ttf-droid-ib \ 230 | # ttf-gelasio-ib \ 231 | # ttf-lohit-odia-ib \ 232 | # ttf-lohit-punjabi-ib \ 233 | # ttf-merriweather-ib \ 234 | # ttf-merriweather-sans-ib \ 235 | # ttf-noto-serif-multilang-ib \ 236 | # ttf-opensans-ib \ 237 | # ttf-signika-family-ib \ 238 | # ttf-ubuntu-font-family-ib 239 | 240 | ############################################################################### 241 | # Setup our initial_configuration service 242 | ############################################################################### 243 | cp /root/initial_configuration.sh /arch/usr/lib/systemd/scripts/ 244 | cat >/arch/usr/lib/systemd/system/initial_configuration.service <> /arch/etc/vconsole.conf 265 | 266 | 267 | if [ "$MODEL" == "MacBook8,1" ]; then 268 | ############################################################################### 269 | # Experimental 270 | ############################################################################### 271 | sed -i "s/MODULES=\"\"/MODULES=\"ahci sd_mod libahci\"/" /arch/etc/mkinitcpio.conf 272 | 273 | else 274 | ############################################################################### 275 | # ahci and sd_mod per this post: https://wiki.archlinux.org/index.php/MacBook 276 | sed -i "s/MODULES=\"\"/MODULES=\"ahci sd_mod\"/" /arch/etc/mkinitcpio.conf 277 | ############################################################################### 278 | fi 279 | 280 | ############################################################################### 281 | # Fix root device not showing up. 282 | # http://superuser.com/questions/769047/unable-to-find-root-device-on-a-fresh-archlinux-install 283 | ############################################################################### 284 | # HOOKS="base udev autodetect modconf block filesystems keyboard fsck" 285 | # HOOKS="base udev fsck block autodetect modconf filesystems keyboard" 286 | OLDLINE=`grep "^HOOKS" /arch/etc/mkinitcpio.conf` 287 | NEWLINE=`echo ${OLDLINE} | sed -e "s/autodetect block/block autodetect/"` 288 | sed -i "s/${OLDLINE}/${NEWLINE}/" /arch/etc/mkinitcpio.conf 289 | 290 | # Fix macbook 12.1 not booting and possibly others 291 | OLDLINE=`grep "^HOOKS" /arch/etc/mkinitcpio.conf` 292 | NEWLINE=`echo ${OLDLINE} | sed -e "s/base udev autodetect modconf block filesystems keyboard fsck/base udev fsck block autodetect modconf filesystems keyboard/"` 293 | sed -i "s/${OLDLINE}/${NEWLINE}/" /arch/etc/mkinitcpio.conf 294 | 295 | ############################################################################### 296 | # Setup Intel GPU 297 | ############################################################################### 298 | if grep -i -A1 "Intel" /systeminfo | grep -qi "GPU" ; then 299 | echo "Machine has an Intel graphics card." 300 | sed -i "s/MODULES=\"/MODULES=\"i915 /" /arch/etc/mkinitcpio.conf 301 | # chroot /arch pacman --noconfirm -R xorg-server 302 | chroot /arch pacman --noconfirm -S xf86-video-intel 303 | # chroot /arch pacman --noconfirm --needed -U /var/cache/pacman/custom/xf86-video-intel*.pkg.tar.xz 304 | 305 | # http://loicpefferkorn.net/2015/01/arch-linux-on-macbook-pro-retina-2014-with-dm-crypt-lvm-and-suspend-to-disk/ 306 | 307 | if [ "$MODEL" == "MacBook8,1" ]; then 308 | echo "options i915 enable_rc6=1 enable_fbc=1" >> /arch/etc/modprobe.d/i915.conf 309 | else 310 | echo "options i915 enable_rc6=1 enable_fbc=1 lvds_downclock=1" >> /arch/etc/modprobe.d/i915.conf 311 | fi 312 | fi 313 | 314 | ############################################################################### 315 | # Setup AMD/ATI Radeon 316 | ############################################################################### 317 | if grep -i -A1 "AMD" /systeminfo | grep -qi "GPU" ; then 318 | echo "Machine has an AMD/ATI graphics card." 319 | 320 | # Install drivers (opensource version) 321 | # chroot /arch pacman --noconfirm --needed -S xf86-video-ati 322 | # sed -i "s/MODULES=\"/MODULES=\"radeon /" /arch/etc/mkinitcpio.conf 323 | # mkdir -p /arch/usr/share/X11/xorg.conf.d 324 | # cat >/arch/usr/share/X11/xorg.conf.d/20-radeon.conf<> /arch/etc/modprobe.d/blacklist.conf 336 | 337 | echo "[catalyst]" >> /arch/etc/pacman.conf 338 | echo "Server = http://catalyst.wirephire.com/repo/catalyst/\$arch" >> /arch/etc/pacman.conf 339 | 340 | # Add the catalyst repo key for later when we re-enable security 341 | chroot /arch pacman-key -r 653C3094 --keyserver hkp://subkeys.pgp.net 342 | chroot /arch pacman-key --lsign 653C3094 343 | 344 | # For whatever reason when the system comes back up it won't remember these keys. 345 | # So lets cache them and import them on first run. 346 | chroot /arch mkdir -p /var/cache/keys 347 | chroot /arch bash -c "pacman-key -e 653C3094 > /var/cache/keys/653C3094.pub" 348 | 349 | # I can't get the keys to work in the chroot in the docker container. TEMP disable. 350 | echo "SigLevel = Never" >> /arch/etc/pacman.conf 351 | 352 | # Sync the new catalyst database 353 | chroot /arch pacman -Sy 354 | 355 | # Install Catalyst drivers. 356 | chroot /arch pacman --noconfirm -Rdd mesa-libgl 357 | chroot /arch pacman --noconfirm --needed -S catalyst-hook 358 | chroot /arch pacman --noconfirm --needed -S catalyst-libgl 359 | 360 | # Update mkinitcpio with our catalyst hook 361 | OLDLINE=`grep "^HOOKS" /arch/etc/mkinitcpio.conf` 362 | NEWLINE=`echo ${OLDLINE} | sed -e "s/fsck/fsck fglrx/"` 363 | sed -i "s/${OLDLINE}/${NEWLINE}/" /arch/etc/mkinitcpio.conf 364 | 365 | chroot /arch systemctl enable catalyst-hook 366 | 367 | echo "AMD/ATI Installed" 368 | fi 369 | 370 | ############################################################################### 371 | # Setup NVIDIA 372 | ############################################################################### 373 | if grep -i -A1 "NVIDIA" /systeminfo | grep -qi "GPU" ; then 374 | echo "Machine has an NVIDIA graphics card." 375 | 376 | # Install Nvidia drivers with automatic re-compilation of the NVIDIA module with kernel update 377 | # Doesn't nothing 378 | # HOOKS="base udev block autodetect modconf filesystems keyboard fsck" 379 | 380 | # Uninstall mesa-libgl since it will conflict with nividia-libgl 381 | chroot /arch pacman --noconfirm -Rdd mesa-libgl 382 | 383 | # Install Nvidia DKMS and Utils 384 | chroot /arch pacman --noconfirm --needed -U /var/cache/pacman/custom/nvidia-*-3*.pkg.tar.xz 385 | 386 | # Install Nvidia hook 387 | chroot /arch pacman --noconfirm --needed -U /var/cache/pacman/custom/nvidia-hook*.pkg.tar.xz 388 | 389 | # Install Nvidia backlight stuff 390 | # dmesg says "No supported Nvidia graphics adapter found" 391 | # chroot /arch bash -c "pacman --noconfirm --needed -U /var/cache/pacman/custom/nvidia-bl-dkms*.pkg.tar.xz" 392 | 393 | # update mkinitcpio with our nvidia hook 394 | OLDLINE=`grep "^HOOKS" /arch/etc/mkinitcpio.conf` 395 | NEWLINE=`echo ${OLDLINE} | sed -e "s/fsck/fsck nvidia/"` 396 | sed -i "s/${OLDLINE}/${NEWLINE}/" /arch/etc/mkinitcpio.conf 397 | 398 | mkdir -p /arch/usr/share/X11/xorg.conf.d 399 | cat >/arch/usr/share/X11/xorg.conf.d/20-nvidia.conf<> /arch/etc/modprobe.d/snd_hda_intel.conf 419 | echo "options usbcore autosuspend=1" >> /arch/etc/modprobe.d/usbcore.conf 420 | 421 | ############################################################################### 422 | # Broadcom network drivers 423 | ############################################################################### 424 | if grep -i -A1 "Broadcom" /systeminfo | grep -qi "MAC" ; then 425 | echo "Machine has an Broadcom network card." 426 | 427 | chroot /arch pacman --noconfirm --needed -U /var/cache/pacman/custom/broadcom-wl-dkms*.pkg.tar.xz 428 | 429 | # Install the Broadcom b43 firmware just in case the user needs it. 430 | # https://wiki.archlinux.org/index.php/Broadcom_wireless 431 | cp -R /firmware/* /arch/lib/firmware/ 432 | fi 433 | 434 | ############################################################################### 435 | # Fix IRQ issues. 436 | # https://wiki.archlinux.org/index.php/MacBook#Sound 437 | ############################################################################### 438 | echo "options snd_hda_intel model=intel-mac-auto" >> /arch/etc/modprobe.d/snd_hda_intel.conf 439 | 440 | ############################################################################### 441 | # Generate locale (change this to yours if it is not US English) 442 | ############################################################################### 443 | chroot /arch locale-gen en_US.UTF-8 444 | 445 | ############################################################################### 446 | # Enable DKMS service 447 | ############################################################################### 448 | # Seems to not exist anymore 449 | # chroot /arch systemctl enable dkms.service 450 | 451 | # Create new account that isn't root. user: user password: user 452 | # You can and should change this later https://wiki.archlinux.org/index.php/Change_username 453 | # Or just delete it and create another. 454 | ############################################################################### 455 | chroot /arch useradd -m -g users -G wheel -s /bin/zsh user 456 | chroot /arch bash -c "echo "user:user" | chpasswd" 457 | 458 | # Mark users password as expired so user changes it from user/user 459 | # User can't log into SDDM if I do this. 460 | # chroot /arch chage -d 0 user 461 | 462 | # allow passwordless sudo for our user 463 | echo "user ALL=(ALL) NOPASSWD: ALL" >> /arch/etc/sudoers 464 | 465 | ############################################################################### 466 | # Give it a host name 467 | ############################################################################### 468 | echo macbook > /arch/etc/hostname 469 | 470 | ############################################################################### 471 | # Enable kernel modules for fan speed and the temperature sensors 472 | ############################################################################### 473 | echo coretemp >> /arch/etc/modules 474 | echo applesmc >> /arch/etc/modules 475 | 476 | ############################################################################### 477 | # Enable Thermald 478 | ############################################################################### 479 | chroot /arch runuser -l user -c "yaourt --noconfirm --needed -S thermald" 480 | chroot /arch systemctl enable thermald 481 | 482 | ############################################################################### 483 | # Enable cpupower and set governer to powersave 484 | ############################################################################### 485 | chroot /arch runuser -l user -c "yaourt --noconfirm --needed -S cpupower" 486 | chroot /arch systemctl enable cpupower 487 | 488 | # works in a Linux docker container but not a mac boot2docker one 489 | # Will run at initial startup. 490 | # chroot /arch cpupower frequency-set -g powersave 491 | 492 | ############################################################################### 493 | # Get latest Early 2015 13" - Version 12,x wireless lan firware otherwise it won't work. 494 | ############################################################################### 495 | # https://wiki.archlinux.org/index.php/MacBook 496 | (cd /arch/usr/lib/firmware/brcm/ && \ 497 | curl -O https://git.kernel.org/cgit/linux/kernel/git/firmware/linux-firmware.git/plain/brcm/brcmfmac43602-pcie.bin) 498 | 499 | ############################################################################### 500 | # Force reinstall microkernel updates so they appear in boot. 501 | ############################################################################### 502 | # chroot /arch pacman -S --noconfirm --needed intel-ucode 503 | chroot /arch pacman -S --noconfirm intel-ucode 504 | echo "done ucode" 505 | ############################################################################### 506 | # Setup rEFInd to boot up using Intel Micokernel updates 507 | ############################################################################### 508 | # Hit F2 for these options 509 | ls /dev 510 | #UUID=$(lsblk -no UUID /dev/sdb1) # Doesn't work in a docker container 511 | echo "start refind setup" 512 | UUID=$(blkid /dev/sdb -o export | grep UUID | head -1) 513 | echo $UUID 514 | #if [ $MODEL == "MacBook8,1" ]; then 515 | if [ $MODEL == "EXPERIMENTAL" ]; then 516 | echo "placeholder" 517 | # echo "\"1\" \"root=$UUID rootfstype=ext4 rw downclock=1 usbcore.autosuspend=1 h initrd=/boot/initramfs-linux.img\" " >> /arch/boot/refind_linux.conf 518 | else 519 | # Normal setup which works fine. 520 | echo "\"Fallback with microkernel updates\" \"root=$UUID rootfstype=ext4 rw loglevel=6 initrd=/boot/intel-ucode.img initrd=/boot/initramfs-linux-fallback.img\" " >> /arch/boot/refind_linux.conf 521 | echo "\"Fallback without microkernel updates\" \"root=$UUID rootfstype=ext4 rw loglevel=6 initrd=/boot/initramfs-linux-fallback\" " >> /arch/boot/refind_linux.conf 522 | echo "\"Graphical Interface\" \"root=$UUID rootfstype=ext4 rw quiet loglevel=6 systemd.unit=graphical.target initrd=/boot/intel-ucode.img initrd=/boot/initramfs-linux.img\" " > /arch/boot/refind_linux.conf 523 | echo "\"Normal with microkernel updates\" \"root=$UUID rootfstype=ext4 rw loglevel=6 initrd=/boot/intel-ucode.img initrd=/boot/initramfs-linux.img\" " >> /arch/boot/refind_linux.conf 524 | echo "\"Normal without microkernel updates\" \"root=$UUID rootfstype=ext4 rw loglevel=6 initrd=/boot/initramfs-linux.img\" " >> /arch/boot/refind_linux.conf 525 | fi 526 | echo "end refind setup" 527 | ############################################################################### 528 | # Setup fstab 529 | # TODO look into not using discard. http://blog.neutrino.es/2013/howto-properly-activate-trim-for-your-ssd-on-linux-fstrim-lvm-and-dmcrypt/ 530 | ############################################################################### 531 | if [ $MODEL == "MacBook8,1" ]; then 532 | # NVMe on 8,1 does't user discard 533 | echo "$UUID / ext4 rw,relatime,data=ordered 0 1" > /arch/etc/fstab 534 | else 535 | echo "$UUID / ext4 discard,rw,relatime,data=ordered 0 1" > /arch/etc/fstab 536 | fi 537 | 538 | echo "efivarfs /sys/firmware/efi/efivars efivarfs rw,nosuid,nodev,noexec,relatime 0 0" >> /arch/etc/fstab 539 | echo "LABEL=EFI /boot/EFI vfat rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro 0 2" >> /arch/etc/fstab 540 | echo "done fstab" 541 | ############################################################################### 542 | # Share our Mac drive with Arch Linux (though read only unless we disable journaling in Mac Os) 543 | # https://support.apple.com/en-us/HT204435 544 | # https://wiki.archlinux.org/index.php/MacBook 545 | # Disabled - user can share later. If issue it breaks the install and difficult to tell why` 546 | ############################################################################### 547 | # mkdir -p /media/mac 548 | # if [ $MODEL == "MacBook8,1" ]; then 549 | # Macbook 12" 2015 uses nvme 550 | # echo "/dev/nvme0n1p2 /media/mac hfsplus auto,user,ro,exec 0 0" >> /arch/etc/fstab 551 | #else 552 | # echo "/dev/sda2 /media/mac hfsplus auto,user,ro,exec 0 0" >> /arch/etc/fstab 553 | #fi 554 | #echo "done sharing" 555 | ############################################################################### 556 | # Enable and setup SDDM Display Manger 557 | ############################################################################### 558 | chroot /arch pacman -S --noconfirm --needed sddm 559 | chroot /arch systemctl enable sddm 560 | cat >/arch/etc/sddm.conf</arch/home/user/.config/xfce4/terminal/terminalrc </arch/home/user/.config/xfce4/terminal/accels.scm </terminal-window/fullscreen" "") 605 | (gtk_accel_path "/terminal-window/contents" "") 606 | EOL 607 | 608 | chroot /arch pacman -Syy --noconfirm 609 | chroot /arch cat /etc/pacman.conf 610 | 611 | ############################################################################### 612 | # Install the xf86-input-mtrack package 613 | # 614 | # The defaults are way to fast for my taste. 615 | # Config is here: https://github.com/BlueDragonX/xf86-input-mtrack 616 | # Config I am trying is from : https://help.ubuntu.com/community/MacBookPro11-1/utopic 617 | ############################################################################### 618 | # Mac Retina doesn't have a trackpad 619 | if [[ $MODEL == *"MacBook"* ]] 620 | then 621 | chroot /arch pacman --noconfirm --needed -U /var/cache/pacman/custom/xf86-input-mtrack*.pkg.tar.xz 622 | cat >/arch/usr/share/X11/xorg.conf.d/10-mtrack.conf < /arch/home/user/.Xmodmap 655 | else 656 | # Install mouse drivers. 657 | 658 | chroot /arch pacman -S --noconfirm --needed xf86-input-mouse 659 | # pacman -S --noconfirm --needed xf86-input-mouse 660 | fi 661 | 662 | ############################################################################### 663 | # Copy over the mac system info in case we need it for something in the future. 664 | ############################################################################### 665 | cp /systeminfo /arch/systeminfo.txt 666 | 667 | ############################################################################### 668 | # Disable autologin for root 669 | ############################################################################### 670 | cat >/arch/etc/systemd/system/getty@tty1.service.d/override.conf<> /arch/home/user/.zshrc 700 | echo "BULLETTRAIN_CONTEXT_BG=\"31\"" >> /arch/home/user/.zshrc 701 | echo "BULLETTRAIN_CONTEXT_FG=\"231\"" >> /arch/home/user/.zshrc 702 | 703 | ############################################################################### 704 | # Update mlocate 705 | ############################################################################### 706 | chroot /arch updatedb 707 | 708 | #------------------------------------------------------------------------------ 709 | #------------------------------------------------------------------------------ 710 | # Final things before syncing to the physical drive. 711 | #------------------------------------------------------------------------------ 712 | #------------------------------------------------------------------------------ 713 | 714 | ############################################################################### 715 | # Create initial ramdisk enviroment. 716 | ############################################################################### 717 | # avoid fsck.aufs error 718 | chroot /arch ln -s /bin/true /sbin/fsck.aufs 719 | chroot /arch pacman --noconfirm -S linux 720 | 721 | # Needed or won't find the root device 722 | chroot /arch mkinitcpio -p linux 723 | 724 | # New Macbook Retina April 2015 Release 725 | # if [ $MODEL == "MacBook8,1" ]; then 726 | # chroot /arch pacman --noconfirm -S linux-lts 727 | # chroot /arch mkinitcpio -p linux-lts 728 | # fi 729 | 730 | ############################################################################### 731 | # Rank mirrors by speed and only use https mirrors 732 | # Sometimes the mirrors page is down so this would break the script so 733 | # lets give it up to five minutes before timing out. 734 | ############################################################################### 735 | # timeout=$(($(date +%s) + 360)) 736 | # until \ 737 | # chroot /arch reflector \ 738 | # --verbose \ 739 | # -l 10 \ 740 | # --protocol https \ 741 | # --sort rate \ 742 | # --save /etc/pacman.d/mirrorlist \ 743 | # 2>/dev/null || [[ $(date +%s) -gt $timeout ]]; do 744 | # : 745 | # done 746 | 747 | ############################################################################### 748 | # Delete the arch user 749 | ############################################################################### 750 | # echo "Deleting arch user." 751 | # chroot /arch userdel -rf arch 752 | 753 | ############################################################################### 754 | # Move any general or custom packages into the pacman cache 755 | ############################################################################### 756 | echo "Moving any general or custom packages into pacman cache" 757 | mv /arch/var/cache/pacman/general/* /arch/var/cache/pacman/pkg/ 758 | mv /arch/var/cache/pacman/custom/* /arch/var/cache/pacman/pkg/ 759 | 760 | ############################################################################### 761 | # Update databases 762 | # Not exactly sure what yaourt is doing that pacman isn't but 763 | # pacman -Syy won't update everyting if the packages changed 764 | # TODO: See /usr/lib/yaourt/*.sh 765 | ############################################################################### 766 | echo "Updating Databases" 767 | chroot /arch runuser -l user -c "yaourt -Syy" 768 | 769 | ############################################################################### 770 | # Restore pacman's security 771 | ############################################################################### 772 | #echo "Restoring pacman's security" 773 | # chroot /arch sed -i "s/SigLevel = Never/#SigLevel = Never/g" /etc/pacman.conf 774 | # TODO: disables infinality fonts so this needs to be redone 775 | 776 | ############################################################################### 777 | # Lets make sure that any config files etc our user has full ownership of. 778 | ############################################################################### 779 | chroot /arch chown -R user:users /home/user/ 780 | 781 | ############################################################################### 782 | # Fix for: https://bugs.archlinux.org/task/42798 783 | # Otherwise pacman can not look up the keys remotely. 784 | # TODO confirm I do not need to do this on first run 785 | ############################################################################### 786 | # chroot /arch pacman-key --populate archlinux 787 | 788 | ############################################################################### 789 | # Re-Import any keys we imported above. 790 | # We already did this above but for some reason we need to do it now or it 791 | # there will be db issues with pacman when ran. 792 | ############################################################################### 793 | # chroot /arch pacman-key -r 962DDE58 --keyserver hkp://subkeys.pgp.net 794 | # chroot /arch pacman-key --lsign 962DDE58 795 | # chroot /arch pacman-key -r AE6866C7962DDE58 --keyserver hkp://subkeys.pgp.net 796 | # chroot /arch pacman-key --lsign AE6866C7962DDE58 797 | 798 | # if grep -i -A1 "AMD" /systeminfo | grep -qi "GPU" ; then 799 | # chroot /arch pacman-key -r 653C3094 --keyserver hkp://subkeys.pgp.net 800 | # chroot /arch pacman-key --lsign 653C3094 801 | # fi 802 | # chroot /arch pacman-key -u 803 | 804 | ############################################################################### 805 | # Force root user to change password on next login. 806 | ############################################################################### 807 | chroot /arch chage -d 0 root 808 | 809 | #------------------------------------------------------------------------------ 810 | #------------------------------------------------------------------------------ 811 | # UP TO THIS POINT WE HAVE NOT ACTUALLY MODIFIED THE USERS SYSTEM 812 | #------------------------------------------------------------------------------ 813 | #------------------------------------------------------------------------------ 814 | 815 | ############################################################################### 816 | # Mount the physical drive 817 | ############################################################################### 818 | mkdir /mnt/archlinux 819 | mount /dev/sdb /mnt/archlinux 820 | 821 | ############################################################################### 822 | # Sync to the physical drive 823 | # 824 | # On very slow USBs docker can time out This has only happened on one USB 825 | # drive so far and appears to be more of a boot2docker issue than anything else. 826 | ############################################################################### 827 | echo "Syncing system to your drive. This will take a couple minutes. (or significantly longer if using USB)" 828 | 829 | time rsync -aAX --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found"} /arch/* /mnt/archlinux 830 | 831 | # Not sure if this is needed but to be safe. 832 | sync 833 | 834 | ############################################################################### 835 | # Helpful message for user 836 | # 837 | # Not sure why mkinitcpio -p linux has to be done again 838 | ############################################################################### 839 | echo " " 840 | echo "If for some reason you get an error device not found" 841 | echo "hit F2 then select a fallback" 842 | echo "then run mkinitcpio -p linux" 843 | echo " " 844 | 845 | ############################################################################### 846 | # Unmount physical drive 847 | ############################################################################### 848 | # delay before unmount to finish writing.otherwise sometimes in use. 849 | sleep 2 850 | 851 | # Unmount main disk 852 | umount /mnt/archlinux 853 | 854 | ############################################################################### 855 | # TODO LIST 856 | ############################################################################### 857 | # Powertop 858 | # Virtulbox VM of Archlinux on the Mac side 859 | # Shared volume 860 | # Encrypted user partition 861 | # Suspend to disk 862 | # Consider zram/zswap https://wiki.archlinux.org/index.php/Maximizing_performance 863 | # Looks like a ton of goodies in helmuthdu's script. https://github.com/helmuthdu/aui 864 | # Reverse Engineer iMac Retina's 5K. I notice that with rEFInd installed it defaults to 4k. 865 | # - Possible this can solve that: https://github.com/0xbb/apple_set_os.efi 866 | echo "*** FINISHED ***" 867 | 868 | # vim:set ts=2 sw=2 et: 869 | -------------------------------------------------------------------------------- /mac-install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #============================================================================== 4 | #============================================================================== 5 | # Copyright (c) 2015 Jonathan Yantis 6 | # yantis@yantis.net 7 | # Released under the MIT license 8 | #============================================================================== 9 | #============================================================================== 10 | 11 | ############################################################################### 12 | # USAGE: 13 | # sh mac-install.sh 50 (would leave 50GB for mac and the rest for Arch Linux) 14 | # sh mac-install.sh USB (Installs to USB drive - Still needs more work on boot) 15 | 16 | ############################################################################### 17 | # Set the disk we are working on. For USB this may change later. 18 | # The default is disk0 19 | ############################################################################### 20 | ROOTDISK=disk0 21 | 22 | ############################################################################### 23 | # Exit on any error whatsoever 24 | # You should be able to just rerun the script at any point and it should 25 | # recover where it left off from. 26 | ############################################################################### 27 | set -e 28 | set -u 29 | 30 | ############################################################################### 31 | # Usage 32 | ############################################################################### 33 | # Exit the script if the user didn't specify MacOS volume size 34 | if [ "$#" -ne 1 ]; then 35 | echo "You must either specify USB or the new MacOs Volume size" 36 | echo "" 37 | echo "In specifiing the size you want your MacOs Volume to be" 38 | echo "It must be at least as big as the data it contains" 39 | echo "On a new install 30GB probably works OK if you are going for minimal" 40 | echo "In this case you would run the script with 30 as the argument" 41 | exit 1 42 | fi 43 | 44 | ############################################################################### 45 | # Keep trying to unmount for up to 10 seconds. Some slow USBs can take a bit. 46 | ############################################################################### 47 | unmount() 48 | { 49 | timeout=$(($(date +%s) + 10)) 50 | until sudo diskutil umount "${1}" 2>/dev/null || [[ $(date +%s) -gt $timeout ]]; do 51 | : 52 | done 53 | } 54 | 55 | ############################################################################### 56 | # Disable sudo password request time out for now. 57 | # Editing sudoers this way on a mac really is no big deal. 58 | # You can quickly fix any mistakes you make to it by: 59 | # Hitting shift+⌘-+g typing /etc. Selecting sudoers and hitting ⌘-+i 60 | # then unlock it and change your permissions to fix it. 61 | ############################################################################### 62 | echo "Temporarily Disabling sudo password timeout" 63 | sudo sh -c 'echo "\nDefaults timestamp_timeout=-1">>/etc/sudoers' 64 | 65 | ############################################################################### 66 | # Mute startup chime 67 | # Unrem this to mute the startup chime (or set the volume 01 to 99 I think) 68 | ############################################################################### 69 | # sudo /usr/sbin/nvram SystemAudioVolume=%01 70 | 71 | ############################################################################### 72 | # Update Mac OSX 73 | # particually any firmware updates (though lets leave this up to the user) 74 | ############################################################################### 75 | # sudo softwareupdate -i -a 76 | 77 | ############################################################################### 78 | # Convert from Core Storage to HFS+ if needed. 79 | ############################################################################### 80 | if diskutil info ${ROOTDISK}s2 | grep -q "Core Storage" ; then 81 | #TODO check if encrypted first.and decrypt 82 | #https://derflounder.wordpress.com/2011/11/23/using-the-command-line-to-unlock-or-decrypt-your-filevault-2-encrypted-boot-drive/ 83 | 84 | #TODO Play with the fusion drive (the latest imac retina has one) 85 | # Note if they have a fusion drive then this will most likely fail with an error. 86 | # "This operation can only be performed if there is one Core Storage physical voluume present in the group" 87 | 88 | echo "Disk ${ROOTDISK}s2 is a Core Storage Volume. Converting to HFS+" 89 | COREVOLUME=$(diskutil list | grep -A1 "Logical Volume on ${ROOTDISK}s2" | tail -1) 90 | sudo diskutil coreStorage revert $COREVOLUME 91 | echo "YOU MUST REBOOT and rerun the script to continue from this point." 92 | exit 1 93 | fi 94 | 95 | ############################################################################### 96 | # Install CLI developer tools (a dependency for homebrew and more) 97 | ############################################################################### 98 | echo "Installing CLI developer tools" 99 | if ! hash brew 2> /dev/null; then 100 | curl -O https://raw.githubusercontent.com/timsutton/osx-vm-templates/master/scripts/xcode-cli-tools.sh 101 | sudo sh xcode-cli-tools.sh 102 | rm xcode-cli-tools.sh 103 | else 104 | echo "CLI developer tools already installed." 105 | fi 106 | 107 | ############################################################################### 108 | # Install homebrew 109 | ############################################################################### 110 | if ! hash brew 2> /dev/null; then 111 | ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" /dev/null; then 127 | # brew install wget 128 | # fi 129 | 130 | ############################################################################### 131 | # Install Virtualbox 132 | ############################################################################### 133 | if ! hash vboxmanage 2> /dev/null; then 134 | echo "*** Installing VirtualBox ***" 135 | 136 | # curl -OL http://download.virtualbox.org/virtualbox/5.1.8/VirtualBox-5.1.8-111374-OSX.dmg 137 | curl -OL http://download.virtualbox.org/virtualbox/5.1.14/VirtualBox-5.1.14-112924-OSX.dmg 138 | 139 | # hdiutil mount VirtualBox-5.1.8-111374-OSX.dmg 140 | hdiutil mount VirtualBox-5.1.14-112924-OSX.dmg 141 | 142 | sudo installer -pkg /Volumes/VirtualBox/VirtualBox.pkg -target / 143 | sleep 2 144 | hdiutil unmount /Volumes/VirtualBox/ 145 | # rm VirtualBox-5.0.24-108355-OSX.dmg 146 | fi 147 | 148 | ############################################################################### 149 | # Install docker-machine 150 | ############################################################################### 151 | if ! hash docker-machine 2> /dev/null; then 152 | echo "*** Installing Docker Machine***" 153 | if ! brew install docker-machine; then 154 | echo "Xcode 8.1 error most likely. Sadly for now you need to get this from developer.apple.com and install by hand " 155 | exit 1 156 | # echo "Xcode 8.1 error most likely so installing from the source site" 157 | # curl -L https://github.com/docker/machine/releases/download/v0.8.2/docker-machine-`uname -s`-`uname -m` >/usr/local/bin/docker-machine 158 | # chmod +x /usr/local/bin/docker-machine 159 | fi 160 | fi 161 | 162 | ############################################################################### 163 | echo "Initialize docker-machine" 164 | ############################################################################### 165 | if ! docker-machine status docker-vm 2> /dev/null; then 166 | echo "*** Initialize docker-machine ***" 167 | docker-machine create --driver virtualbox docker-vm 168 | fi 169 | 170 | ############################################################################### 171 | # Install Docker 172 | ############################################################################### 173 | if ! hash docker 2> /dev/null; then 174 | echo "Installing docker" 175 | if ! brew install docker; then 176 | echo "Xcode 8.1 error most likely. Sadly for now you need to get this from developer.apple.com and install by hand " 177 | exit 1 178 | fi 179 | fi 180 | 181 | 182 | ############################################################################### 183 | # Install boot2docker 184 | ############################################################################### 185 | if ! hash boot2docker 2> /dev/null; then 186 | echo "Installing boot2docker" 187 | if ! brew install boot2docker; then 188 | echo "Xcode 8.1 error most likely. Sadly for now you need to get this from developer.apple.com and install by hand " 189 | exit 1 190 | fi 191 | fi 192 | 193 | ############################################################################### 194 | # Install ZSH and Oh-my-zsh 195 | # You don't need this but I like it when working with this since while debugging this script 196 | ############################################################################### 197 | if ! hash zsh 2> /dev/null; then 198 | echo "brew install zsh" > install_zsh.sh 199 | echo "curl -L https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh | sh" >> install_zsh.sh 200 | fi 201 | 202 | ############################################################################### 203 | # Install Paragon ExtFS 204 | ############################################################################### 205 | if ! hash fsck_ufsd_ExtFS 2> /dev/null; then 206 | curl -O http://dl.paragon-software.com/demo/extmac10_trial.dmg 207 | hdiutil attach extmac10_trial.dmg 208 | # sudo installer -pkg /Volumes/ParagonFS.localized/FSInstaller.app/Contents/Resources/Paragon\ ExtFS\ for\ Mac\ OS\ X.pkg -target / 209 | sudo installer -pkg /Volumes/ParagonFS.localized/FSInstaller.app/Contents/Resources/Paragon\ ExtFS\ for\ Mac.pkg -target / 210 | sleep 2 211 | hdiutil detach -force /Volumes/ParagonFS.localized 212 | rm extmac10_trial.dmg 213 | fi 214 | 215 | ############################################################################### 216 | echo "Resize Disk" 217 | ############################################################################### 218 | # Did the user select USB, Usb, usb instead of a disk size? 219 | INSTALL_TYPE=$(echo $1 | tr '[:upper:]' '[:lower:]') 220 | if [ $INSTALL_TYPE == "usb" ]; then 221 | # Detect the first USB disk 222 | USBDISK="NONE" 223 | for i in $(diskutil list | grep -E "[ ]+[0-9]+:.*disk[0-9]+" | sed 's/.*\(disk.*\)/\1/'); 224 | do 225 | if diskutil info $i | grep -q "USB"; then 226 | USBDISK=$i 227 | break 228 | fi 229 | done 230 | 231 | if [ $USBDISK == "NONE" ]; then 232 | echo "No USB Disk found. Exiting" 233 | exit 1 234 | else 235 | echo USB DISK $USBDISK found. 236 | ROOTDISK=$USBDISK 237 | if ! diskutil eraseDISK UFSD_EXTFS4 "1" $USBDISK; then 238 | echo "Erase failed. Try rebooting and rerunning the script" 239 | fi 240 | fi 241 | 242 | else 243 | echo "Resize MacOs drive to X gb and create ext4 volume" 244 | # TODO: This could be improved to detect disks like we do with the USB above. 245 | # if diskutil list ${ROOTDISK} | grep -q "Microsoft Basic Data" ; then 246 | if diskutil list ${ROOTDISK} | grep -q "Linux Filesystem" ; then 247 | echo "Skipping disk resize and ext4 volume creation since already done." 248 | echo "Formating Disk." 249 | diskutil eraseVolume UFSD_EXTFS4 "1" ${ROOTDISK}s4 250 | echo "Disk formated" 251 | else 252 | sudo diskutil resizeVolume ${ROOTDISK}s2 ${1}g 1 UFSD_EXTFS4 "1" 0g 253 | fi 254 | fi 255 | 256 | 257 | echo "Get our ext4 volume. It should always be at disk0s4. But just in case." 258 | # EXT4VOL=$(diskutil list ${ROOTDISK} | grep "Microsoft Basic Data" | awk '{print $8}') 259 | EXT4VOL=$(diskutil list ${ROOTDISK} | grep "Linux Filesystem" | awk '{print $7}') 260 | 261 | echo $EXT4VOL 262 | 263 | # Sanity Check 264 | if echo $EXT4VOL | grep -q "${ROOTDISK}s" ; then 265 | echo "Our ext4 volume is $EXT4VOL" 266 | else 267 | echo "Could not find our ext4 volume. Try deleting all the volumes except Macintosh HD and restarting your computer." 268 | echo "It is also possible that your Paragon ExtFS Trial has expired." 269 | exit 1 270 | fi 271 | 272 | ############################################################################### 273 | echo "Setting up Virtual Disk to Physical Disk mapping" 274 | ############################################################################### 275 | # If boo2docker is already running then something went wrong and the user restarted the script 276 | if ! [ "$(docker-machine status docker-vm)" = "Running" ] ; then 277 | 278 | # Create some temp file names for our virtual disks. 279 | MAINDISK=`mktemp /tmp/main.vmdk.XXXXXX` || exit 1 280 | rm $MAINDISK 281 | 282 | # Make sure main disk is unmounted 283 | if [ -d /Volumes/1 ]; 284 | then 285 | unmount $EXT4VOL 286 | fi 287 | 288 | echo "Creating vmdk" 289 | sudo vboxmanage internalcommands createrawvmdk -filename $MAINDISK -rawdisk /dev/$EXT4VOL 290 | sudo chmod 666 $MAINDISK 291 | sudo chmod 666 /dev/$EXT4VOL 292 | echo "storageattach" 293 | vboxmanage storageattach docker-vm --storagectl "SATA" --port 2 --device 0 --type hdd --medium $MAINDISK 294 | echo "starting docker-vm" 295 | docker-machine start docker-vm 296 | fi 297 | 298 | ############################################################################### 299 | echo "Get Boot2Docker exports" 300 | docker-machine regenerate-certs docker-vm --force 301 | eval "$(docker-machine env docker-vm)" 302 | ############################################################################### 303 | 304 | ############################################################################### 305 | # Generate system profile so we have information about this machine inside the VM 306 | # If it exists as a directory delete it. (why does this keep getting created?) 307 | ############################################################################### 308 | if [ -d ~/systeminfo.txt ]; 309 | then 310 | echo "Removing systeminfo.txt directory" 311 | rm -r ~/systeminfo.txt 312 | fi 313 | 314 | if [ ! -f ~/systeminfo.txt ]; 315 | then 316 | echo "Generating system profile" 317 | system_profiler -detailLevel mini > ~/systeminfo.txt 318 | fi 319 | 320 | ############################################################################### 321 | # Download the rootfs 322 | ############################################################################### 323 | if [ ! -f ~/airootfs.sfs ]; 324 | then 325 | echo "Downloading rootfs image" 326 | cd ~ 327 | # curl -OL http://mirror.rackspace.com/archlinux/iso/2016.10.01/arch/x86_64/airootfs.sfs 328 | curl -OL http://mirror.rackspace.com/archlinux/iso/2017.05.01/arch/x86_64/airootfs.sfs 329 | fi 330 | 331 | ############################################################################### 332 | # Pull latest image 333 | # Not really needed for one time use but while working on the script it is nice. 334 | ############################################################################### 335 | docker pull yantis/instant-archlinux-on-mac 336 | 337 | ############################################################################### 338 | # Install rEFInd 339 | ############################################################################### 340 | # Check if rEFInd already installed 341 | if [ ! -d /Volumes/ESP ]; then 342 | echo "Mounting EFI volume" 343 | sudo mkdir -p /Volumes/ESP 344 | sudo mount -t msdos /dev/${ROOTDISK}s1 /Volumes/ESP 345 | fi 346 | 347 | # # Remove rEFInd 348 | # if [ -d /Volumes/ESP/EFI/refind ]; then 349 | # echo "rEFInd installed uninstalling it." 350 | 351 | # # Delete rEFInd 352 | # sudo rm -rf /Volumes/ESP/EFI/refind 353 | # fi 354 | 355 | if [ -d /Volumes/ESP/EFI/refind ]; then 356 | echo "rEFInd already installed so not reinstalling." 357 | 358 | unmount /Volumes/ESP 359 | else 360 | 361 | if [ $INSTALL_TYPE != "usb" ]; then 362 | unmount /Volumes/ESP 363 | fi 364 | 365 | # Install rEFInd 366 | curl -OL http://downloads.sourceforge.net/project/refind/0.10.4/refind-bin-0.10.4.zip 367 | unzip -o refind-bin-0.10.4.zip 368 | if [ $INSTALL_TYPE == "usb" ]; then 369 | # (cd refind-bin-0.8.7 && sudo sh install.sh --alldrivers --usedefault /dev/${ROOTDISK}s1 ) 370 | echo "Installing rEFInd to USB" 371 | mkdir -p /Volumes/ESP/EFI 372 | cp -R refind-bin-0.10.4/refind /Volumes/ESP/EFI 373 | cp refind-bin-0.10.4/refind/refind.conf-sample /Volumes/ESP/EFI/refind/refind.conf 374 | 375 | else 376 | sh refind-bin-0.10.4/refind-install --alldrivers --yes 377 | fi 378 | 379 | rm -r refind-bin-0.10.4 380 | rm refind-bin-0.10.4.zip 381 | 382 | # Sometimes rEFInd fails to unmount /Volumes/ESP so lets use that if its already open 383 | if [ ! -d /Volumes/ESP ]; 384 | then 385 | sudo mkdir -p /Volumes/ESP 386 | sudo mount -t msdos /dev/${ROOTDISK}s1 /Volumes/ESP 387 | fi 388 | 389 | # Install the reFInd minimal theme if the user doesn't already have it installed 390 | # I moved this out of the docker container so it isn't as clean (ie: re-remounting etc) 391 | echo "Checking if rEFInd minimal theme is installed" 392 | 393 | if [ ! -d /Volumes/ESP/EFI/refind/rEFInd-minimal ]; 394 | then 395 | 396 | cd /Volumes/ESP/EFI/refind 397 | # You can pick different forks of this to your taste. 398 | git clone https://github.com/dylansm/rEFInd-minimal 399 | 400 | # Default is 128x128 Lets make it is 256x256 (still tiny on retina displays) 401 | sed -i.bak "s/#big_icon_size 256/big_icon_size 256/" refind.conf 402 | rm refind.conf.bak 403 | echo "include rEFInd-minimal/theme.conf" >> refind.conf 404 | 405 | # Leave or we can't unmount 406 | cd ~ 407 | fi 408 | 409 | sudo diskutil unmount /Volumes/ESP 410 | fi 411 | 412 | ############################################################################### 413 | # Even if we failed clean up what we can 414 | # so no more exits on errors from this point on. 415 | ############################################################################### 416 | set +e 417 | 418 | ############################################################################### 419 | # Run the container but make the script user definable as who knows what changes 420 | # a user might want to make to the install script. 421 | ############################################################################### 422 | SUCCESSFUL_INSTALL=0 423 | docker run \ 424 | --privileged \ 425 | -v ~/systeminfo.txt:/systeminfo \ 426 | -v ~/airootfs.sfs:/root/airootfs.sfs \ 427 | -u root \ 428 | --rm \ 429 | -ti \ 430 | yantis/instant-archlinux-on-mac \ 431 | bash -c "run-remote-script https://raw.githubusercontent.com/yantis/instant-archlinux-on-mac/master/mac-install-internal.sh" 432 | 433 | # Flag that we did or did not have a successful install 434 | SUCCESSFUL_INSTALL=$? 435 | 436 | ############################################################################### 437 | # Shut down the boo2docker virtual machine 438 | ############################################################################### 439 | timeout=$(($(date +%s) + 60)) 440 | # until docker-image stop 2>/dev/null || [[ $(date +%s) -gt $timeout ]]; do 441 | until docker-machine stop docker-vm 2>/dev/null || [[ $(date +%s) -gt $timeout ]]; do 442 | : 443 | done 444 | 445 | ############################################################################### 446 | # Remove our physical harddrive from the boot2docker virtualmachine 447 | ############################################################################### 448 | echo "Remove our physical harddrive from the boot2docker virtualmachine" 449 | vboxmanage storageattach docker-vm --storagectl "SATA" --port 2 --device 0 --type hdd --medium none 450 | 451 | ############################################################################### 452 | # Remove our docker image 453 | ############################################################################### 454 | # docker rmi yantis/instant-archlinux-on-mac 455 | 456 | ############################################################################### 457 | # Restore security 458 | ############################################################################### 459 | sudo chmod 660 /dev/${ROOTDISK}s1 460 | sudo sed -i.bak "s/Defaults timestamp_timeout=-1/#Defaults timestamp_timeout=-1/" /etc/sudoers 461 | 462 | ############################################################################### 463 | # All Done 464 | ############################################################################### 465 | echo "*******************************************************" 466 | if [ $SUCCESSFUL_INSTALL -ne 0 ]; then 467 | echo "ERROR: The install was not successful please try again." 468 | echo "*******************************************************" 469 | else 470 | echo "DONE - REBOOT NOW TO USE ARCH LINUX." 471 | echo "*******************************************************" 472 | read -p "Press [Enter] key to REBOOT or CTRL C to keep using Mac OSX" 473 | sudo reboot 474 | fi 475 | 476 | # vim:set ts=2 sw=2 et: 477 | -------------------------------------------------------------------------------- /tools/mount-efi.sh: -------------------------------------------------------------------------------- 1 | # Mount the EFI Volume 2 | 3 | #!/bin/bash 4 | if [ ! -d /Volumes/ESP ]; then 5 | echo "Mounting EFI volume" 6 | sudo mkdir -p /Volumes/ESP 7 | sudo mount -t msdos /dev/disk0s1 /Volumes/ESP 8 | fi 9 | -------------------------------------------------------------------------------- /tools/remove-rEFInd.sh: -------------------------------------------------------------------------------- 1 | # Remove rEFInd 2 | 3 | #!/bin/bash 4 | if [ ! -d /Volumes/ESP ]; then 5 | echo "Mounting EFI volume" 6 | sudo mkdir -p /Volumes/ESP 7 | sudo mount -t msdos /dev/disk0s1 /Volumes/ESP 8 | fi 9 | sudo rm -r /Volumes/ESP/EFI/refind 10 | -------------------------------------------------------------------------------- /uninstall.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #============================================================================== 4 | #============================================================================== 5 | # Copyright (c) 2016 Jonathan Yantis 6 | # yantis@yantis.net 7 | # Released under the MIT license 8 | #============================================================================== 9 | #============================================================================== 10 | 11 | 12 | ############################################################################### 13 | # Set the disk we are working on. For USB this may change later. 14 | # The default is disk0 15 | ############################################################################### 16 | ROOTDISK=disk0 17 | 18 | set -u 19 | 20 | ############################################################################### 21 | # Keep trying to unmount for up to 10 seconds. Some slow USBs can take a bit. 22 | ############################################################################### 23 | unmount() 24 | { 25 | timeout=$(($(date +%s) + 10)) 26 | until sudo diskutil umount "${1}" 2>/dev/null || [[ $(date +%s) -gt $timeout ]]; do 27 | : 28 | done 29 | } 30 | 31 | ############################################################################### 32 | # Disable sudo password request time out for now. 33 | # Editing sudoers this way on a mac really is no big deal. 34 | # You can quickly fix any mistakes you make to it by: 35 | # Hitting shift+⌘-+g typing /etc. Selecting sudoers and hitting ⌘-+i 36 | # then unlock it and change your permissions to fix it. 37 | ############################################################################### 38 | echo "Temporarily Disabling sudo password timeout" 39 | sudo sh -c 'echo "\nDefaults timestamp_timeout=-1">>/etc/sudoers' 40 | 41 | ############################################################################## 42 | # Uninstall Boot2Docker 43 | ############################################################################### 44 | if hash boot2docker 2> /dev/null; then 45 | echo "Removing boot2docker" 46 | boot2docker stop 47 | boot2docker delete 48 | brew uninstall --force boot2docker 49 | fi 50 | 51 | ############################################################################### 52 | # Uninstall docker" 53 | ############################################################################### 54 | if hash docker-machine 2> /dev/null; then 55 | # echo "Remove our docker image" 56 | # docker rmi yantis/instant-archlinux-on-mac 57 | 58 | echo "Uninstalling docker-vm" 59 | yes | docker-machine rm docker-vm 60 | 61 | ############################################################################### 62 | # Uninstall docker 63 | ############################################################################### 64 | echo "Uninstalling docker" 65 | brew uninstall --force docker-machine 66 | brew uninstall --force docker 67 | brew uninstall --force boot2docker 68 | fi 69 | 70 | ############################################################################### 71 | # Uninstall virtualbox 72 | ############################################################################### 73 | if hash vboxmanage 2> /dev/null; then 74 | 75 | if [ ! -f VirtualBox-5.1.8-111374-OSX.dmg ]; 76 | then 77 | curl -OL http://download.virtualbox.org/virtualbox/5.1.8/VirtualBox-5.1.8-111374-OSX.dmg 78 | fi 79 | 80 | hdiutil mount VirtualBox-5.1.8-111374-OSX.dmg 81 | sudo sh /Volumes/VirtualBox/VirtualBox_Uninstall.tool --unattended 82 | sleep 2 83 | hdiutil unmount /Volumes/VirtualBox/ 84 | 85 | # Unrem this to remove the downloaded install file. 86 | # rm VirtualBox-4.3.26-98988-OSX.dmg 87 | fi 88 | 89 | ############################################################################### 90 | # Remove Archlinux Volume 91 | ############################################################################### 92 | if [ -d /Volumes/1 ]; then 93 | echo "Removing ArchLinux Volume" 94 | 95 | # echo "Get our ext4 volume. It should always be at disk0s4. But just in case." 96 | EXT4VOL=$(diskutil list ${ROOTDISK} | grep "Linux Filesystem" | awk '{print $7}') 97 | 98 | echo $EXT4VOL 99 | 100 | # Sanity Check 101 | if echo $EXT4VOL | grep -q "${ROOTDISK}s" ; then 102 | echo "Our ext4 volume is $EXT4VOL" 103 | fi 104 | 105 | unmount $EXT4VOL 106 | sudo rm -rf /Volumes/1 107 | 108 | # Todo need to delete the Volume with diskutil 109 | 110 | fi 111 | 112 | ############################################################################### 113 | # Remove rEFInd 114 | ############################################################################### 115 | 116 | if [ ! -d /Volumes/ESP ]; then 117 | echo "Mounting EFI volume" 118 | sudo mkdir -p /Volumes/ESP 119 | sudo mount -t msdos /dev/disk0s1 /Volumes/ESP 120 | echo "rEFInd installed uninstalling it." 121 | sudo rm -rf /Volumes/ESP/EFI/refind 122 | fi 123 | 124 | ############################################################################### 125 | # Restore security 126 | ############################################################################### 127 | sudo sed -i.bak "s/Defaults timestamp_timeout=-1/#Defaults timestamp_timeout=-1/" /etc/sudoers 128 | 129 | ############################################################################### 130 | # All Done 131 | ############################################################################### 132 | 133 | # vim:set ts=2 sw=2 et: 134 | --------------------------------------------------------------------------------