Skip to content

Commit

Permalink
seems to be working
Browse files Browse the repository at this point in the history
  • Loading branch information
Jamesits committed Jan 16, 2018
1 parent 1b261df commit feea81f
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 7 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
*.iso
build/
release/
20 changes: 13 additions & 7 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ abs_path() {
iso="archlinux-2018.01.01-x86_64.iso"
arch="x86_64"
workdir="build"
output_file="archlinux-miner.squashfs"
output_dir="release"

if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root"
exit 1
fi

sudo rm -rf $workdir || true
mkdir $workdir
mkdir -p $workdir
7z x -o$workdir/iso $iso
mv $workdir/iso/arch/boot/$arch/vmlinuz $workdir/vmlinuz
mv $workdir/iso/arch/boot/intel_ucode.img $workdir/intel_ucode.img
Expand All @@ -27,7 +27,8 @@ mv $workdir/iso/arch/$arch/airootfs.sfs $workdir/archlinux.squashfs

unsquashfs -f -d $workdir/squashfs-root $workdir/archlinux.squashfs

cat config/mirrorlist $workdir/squashfs-root/etc/pacman.d/mirrorlist > $workdir/squashfs-root/etc/pacman.d/mirrorlist
cat config/mirrorlist $workdir/squashfs-root/etc/pacman.d/mirrorlist > $workdir/mirrorlist
mv $workdir/mirrorlist $workdir/squashfs-root/etc/pacman.d/mirrorlist
cat <<-EOF | $workdir/squashfs-root/bin/arch-chroot $workdir/squashfs-root/ /bin/bash
echo "pacman-key takes awhile sometimes, please be patient..."
pacman-key --init
Expand All @@ -53,9 +54,14 @@ cat <<-EOF | $workdir/squashfs-root/bin/arch-chroot $workdir/squashfs-root/ /bin
# sudo cp $asset_dir/authorized_keys squashfs-root/root/.ssh/authorized_keys
# sudo chmod 600 squashfs-root/root/.ssh/authorized_keys

mksquashfs $workdir/squashfs-root $output_file
mksquashfs $workdir/squashfs-root $workdir/airootfs.sfs

rm -rf $workdir/squashfs-root
rm $workdir/archlinux.squashfs
rm -rf $workdir/iso
# copy build result to release folder
mkdir -p $output_dir/arch/boot/$arch
mkdir -p $output_dir/arch/$arch
mv $workdir/iso/arch/boot/intel_ucode.{img,license} $output_dir/arch/boot
mv $workdir/iso/arch/boot/$arch/{vmlinuz,archiso.img} $output_dir/arch/boot/$arch
mv $workdir/airootfs.sfs $output_dir/arch/$arch
mv config/boot.cfg $output_dir

rm -rf $workdir
10 changes: 10 additions & 0 deletions config/boot.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!ipxe

# prompt --key 0x02 --timeout 2000 Press Ctrl-B for the iPXE command line... && shell ||

set http_root http://192.168.88.16:8000
set arch x86_64
kernel ${http_root}/arch/boot/${arch}/vmlinuz initrd=archiso.img archiso_http_srv=${http_root} archisobasedir=arch ip=:::::eth0:dhcp
initrd ${http_root}/arch/boot/intel_ucode.img
initrd ${http_root}/arch/boot/${arch}/archiso.img
boot

0 comments on commit feea81f

Please sign in to comment.