Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
pnx committed Jan 22, 2020
0 parents commit 1fe2369
Show file tree
Hide file tree
Showing 28 changed files with 542 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .cache/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*
!.gitignore
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
rootfs
image
output
*.tar.*
32 changes: 32 additions & 0 deletions chroot.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/bash
# Setup a proper chroot environment.

ROOTFS=$(pwd)/rootfs

function exec_chroot {
echo -e "[\e[34mCHROOT\e[0m]" $@
sudo chroot ${ROOTFS} env HOME=/root LC_ALL=C /bin/bash $@
}

# Check rootfs dir.
if [ ! -d "${ROOTFS}" ]; then
echo "Missing rootfs (${ROOTFS}) directory."
exit 1
fi

# Mount dev and run
sudo mount --bind /dev ${ROOTFS}/dev
sudo mount --bind /run ${ROOTFS}/run

# Init chroot.
exec_chroot /scripts/init.sh

# Enter chroot shell.
exec_chroot

# Clenup env.
exec_chroot /scripts/exit.sh

# Unmount.
sudo umount ${ROOTFS}/dev
sudo umount ${ROOTFS}/run
9 changes: 9 additions & 0 deletions config/README.diskdefines
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#define DISKNAME EOSIO xubuntu
#define TYPE binary
#define TYPEbinary 1
#define ARCH amd64
#define ARCHamd64 1
#define DISKNUM 1
#define DISKNUM1 1
#define TOTALNUM 0
#define TOTALNUM0 1
30 changes: 30 additions & 0 deletions config/grub.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
search --set=root --file /ubuntu

insmod all_video

set default="0"
set timeout=30

menuentry "Boot EOSIO Live" {
linux /casper/vmlinuz boot=casper quiet splash ---
initrd /casper/initrd
}

menuentry "Check disc for defects" {
linux /casper/vmlinuz boot=casper integrity-check quiet splash ---
initrd /casper/initrd
}

# These dont work :)

#menuentry "Test memory Memtest86+ (BIOS)" {
# linux16 /install/memtest86+
#}

#menuentry "Test memory Memtest86 (UEFI)" {
# insmod part_gpt
# insmod search_fs_uuid
# insmod chain
# loopback loop /install/memtest86
# chainloader (loop,gpt1)/efi/boot/BOOTX64.efi
#}
3 changes: 3 additions & 0 deletions config/image.vars
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
IMAGE_VERSION=01
IMAGE_NAME="eosio-live"
IMAGE_FILENAME="eosio-live-${IMAGE_VERSION}.iso"
3 changes: 3 additions & 0 deletions config/rootfs-bootstrap.vars
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
ROOTFS_ARCH=amd64
ROOTFS_VARIANT=minbase
ROOTFS_VERSION=bionic
115 changes: 115 additions & 0 deletions create-image.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
#!/bin/bash

source config/image.vars

# Clear and create directories.
rm -fr image/*
mkdir -p image/{casper,isolinux,install}

# Copy kernel images
sudo cp rootfs/boot/vmlinuz-* image/casper/vmlinuz
sudo cp rootfs/boot/initrd.img-* image/casper/initrd

# Copy memtest BIOS
sudo cp rootfs/boot/memtest86+.bin image/install/memtest86+

# Copy memtest UEFI
UEFI_MEMTEST_CACHE=.cache/memtest86-uefi.zip
if [ ! -f ${UEFI_MEMTEST_CACHE} ]; then
wget https://www.memtest86.com/downloads/memtest86-usb.zip \
-O ${UEFI_MEMTEST_CACHE}
fi

unzip -p ${UEFI_MEMTEST_CACHE} memtest86-usb.img > image/install/memtest86

#
# Grup config
#

touch image/ubuntu
cp config/grub.cfg image/isolinux/

# Manifest
sudo chroot rootfs dpkg-query -W --showformat='${Package} ${Version}\n' | sudo tee image/casper/filesystem.manifest > /dev/null
sudo cp -v image/casper/filesystem.manifest image/casper/filesystem.manifest-desktop
sudo sed -i '/ubiquity/d' image/casper/filesystem.manifest-desktop
sudo sed -i '/casper/d' image/casper/filesystem.manifest-desktop
sudo sed -i '/discover/d' image/casper/filesystem.manifest-desktop
sudo sed -i '/laptop-detect/d' image/casper/filesystem.manifest-desktop
sudo sed -i '/os-prober/d' image/casper/filesystem.manifest-desktop

# Compress filesystem.
sudo mv rootfs/scripts /tmp/squashfs
sudo mksquashfs rootfs/ image/casper/filesystem.squashfs
sudo mv /tmp/squashfs rootfs/scripts

# Write filesystem size
printf $(sudo du -sx --block-size=1 rootfs | cut -f1) > image/casper/filesystem.size

cp config/README.diskdefines image/


pushd image > /dev/null

# install grub (BIOS)
grub-mkstandalone \
--format=x86_64-efi \
--output=isolinux/bootx64.efi \
--locales="" \
--fonts="" \
"boot/grub/grub.cfg=isolinux/grub.cfg"

# install grub (UEFI)
(
cd isolinux && \
dd if=/dev/zero of=efiboot.img bs=1M count=10 && \
sudo mkfs.vfat efiboot.img && \
mmd -i efiboot.img efi efi/boot && \
mcopy -i efiboot.img ./bootx64.efi ::efi/boot/
)

# Create grub image
grub-mkstandalone \
--format=i386-pc \
--output=isolinux/core.img \
--install-modules="linux16 linux normal iso9660 biosdisk memdisk search tar ls" \
--modules="linux16 linux normal iso9660 biosdisk search" \
--locales="" \
--fonts="" \
"boot/grub/grub.cfg=isolinux/grub.cfg"

cat /usr/lib/grub/i386-pc/cdboot.img isolinux/core.img > isolinux/bios.img

# Generate md5sum.txt
sudo /bin/bash -c "(find . -type f -print0 | xargs -0 md5sum | grep -v "\./md5sum.txt" > md5sum.txt)"

mkdir -p ../output

# Now create the iso.
sudo xorriso \
-as mkisofs \
-iso-level 3 \
-full-iso9660-filenames \
-volid "${IMAGE_NAME}" \
-eltorito-boot boot/grub/bios.img \
-no-emul-boot \
-boot-load-size 4 \
-boot-info-table \
--eltorito-catalog boot/grub/boot.cat \
--grub2-boot-info \
--grub2-mbr /usr/lib/grub/i386-pc/boot_hybrid.img \
-eltorito-alt-boot \
-e EFI/efiboot.img \
-no-emul-boot \
-append_partition 2 0xef isolinux/efiboot.img \
-output "../output/${IMAGE_FILENAME}" \
-graft-points \
"." \
/boot/grub/bios.img=isolinux/bios.img \
/EFI/efiboot.img=isolinux/efiboot.img

popd > /dev/null

pushd output > /dev/null
md5sum ${IMAGE_FILENAME} > $(echo ${IMAGE_FILENAME} | sed 's/iso$/md5/')
popd > /dev/null
7 changes: 7 additions & 0 deletions overlay/etc/apt/sources.list
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
deb https://mirrors.ocf.berkeley.edu/ubuntu/ bionic main restricted universe multiverse
deb-src https://mirrors.ocf.berkeley.edu/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.ocf.berkeley.edu/ubuntu/ bionic-security main restricted universe multiverse
deb-src https://mirrors.ocf.berkeley.edu/ubuntu/ bionic-security main restricted universe multiverse
deb https://mirrors.ocf.berkeley.edu/ubuntu/ bionic-updates main restricted universe multiverse
deb-src https://mirrors.ocf.berkeley.edu/ubuntu/ bionic-updates main restricted universe multiverse

14 changes: 14 additions & 0 deletions overlay/etc/casper.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# This file should go in /etc/casper.conf
# Supported variables are:
# USERNAME, USERFULLNAME, HOST, BUILD_SYSTEM, FLAVOUR

export USERNAME="eos"
export USERFULLNAME="Live session user"
export HOST="eosiolive"
export BUILD_SYSTEM="Ubuntu"

# USERNAME and HOSTNAME as specified above won't be honoured and will be set to
# flavour string acquired at boot time, unless you set FLAVOUR to any
# non-empty string.

export FLAVOUR="Ubuntu"
6 changes: 6 additions & 0 deletions overlay/etc/netplan/01-network-manager.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# This file describes the network interfaces available on your system
# For more information, see netplan(5).
network:
version: 2
renderer: NetworkManager

117 changes: 117 additions & 0 deletions overlay/etc/skel/.bashrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples

# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac

# don't put duplicate lines or lines starting with space in the history.
# See bash(1) for more options
HISTCONTROL=ignoreboth

# append to the history file, don't overwrite it
shopt -s histappend

# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
HISTSIZE=1000
HISTFILESIZE=2000

# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize

# If set, the pattern "**" used in a pathname expansion context will
# match all files and zero or more directories and subdirectories.
#shopt -s globstar

# make less more friendly for non-text input files, see lesspipe(1)
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"

# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
debian_chroot=$(cat /etc/debian_chroot)
fi

# set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
xterm-color|*-256color) color_prompt=yes;;
esac

# uncomment for a colored prompt, if the terminal has the capability; turned
# off by default to not distract the user: the focus in a terminal window
# should be on the output of commands, not on the prompt
#force_color_prompt=yes

if [ -n "$force_color_prompt" ]; then
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
# We have color support; assume it's compliant with Ecma-48
# (ISO/IEC-6429). (Lack of such support is extremely rare, and such
# a case would tend to support setf rather than setaf.)
color_prompt=yes
else
color_prompt=
fi
fi

if [ "$color_prompt" = yes ]; then
PS1='${debian_chroot:+($debian_chroot)}\[\033[0;37m\]\u/\[\033[01;33m\]\h\[\033[00m\] \[\033[0;32m\]\w\[\033[00m\]> '
else
PS1='${debian_chroot:+($debian_chroot)}\u/\h \w\> '
fi
unset color_prompt force_color_prompt

# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u/\h: \w\a\]$PS1"
;;
*)
;;
esac

# enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
alias ls='ls --color=auto'
#alias dir='dir --color=auto'
#alias vdir='vdir --color=auto'

alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
fi

# colored GCC warnings and errors
#export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'

# some more ls aliases
alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'

# Add an "alert" alias for long running commands. Use like so:
# sleep 10; alert
alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'

# Alias definitions.
# You may want to put all your additions into a separate file like
# ~/.bash_aliases, instead of adding them here directly.
# See /usr/share/doc/bash-doc/examples in the bash-doc package.

if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
fi

# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
if ! shopt -oq posix; then
if [ -f /usr/share/bash-completion/bash_completion ]; then
. /usr/share/bash-completion/bash_completion
elif [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
fi
1 change: 1 addition & 0 deletions overlay/etc/skel/Desktop/README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>

<channel name="xfce4-desktop" version="1.0">
<property name="desktop-icons" type="empty">
<property name="style" type="int" value="2"/>
<property name="file-icons" type="empty">
<property name="show-home" type="bool" value="true"/>
<property name="show-filesystem" type="bool" value="true"/>
<property name="show-removable" type="bool" value="true"/>
<property name="show-trash" type="bool" value="false"/>
</property>
<property name="icon-size" type="uint" value="32"/>
<property name="tooltip-size" type="double" value="64.000000"/>
</property>
<property name="backdrop" type="empty">
<property name="screen0" type="empty">
<property name="monitor0" type="empty">
<property name="image-path" type="string" value="/usr/share/backgrounds/south-west-eden.jpg"/>
<property name="image-style" type="int" value="5"/>
<property name="image-show" type="bool" value="true"/>
</property>
<property name="monitor1" type="empty">
<property name="image-path" type="string" value="/usr/share/backgrounds/south-west-eden.jpg"/>
<property name="image-style" type="int" value="5"/>
<property name="image-show" type="bool" value="true"/>
</property>
</property>
</property>
</channel>
Loading

0 comments on commit 1fe2369

Please sign in to comment.