First working minimal live with the new live-sdk

This commit is contained in:
KatolaZ 2017-12-11 11:13:19 +00:00
parent 413cf421ea
commit 9a912fe833
3 changed files with 645 additions and 1 deletions

View File

@ -0,0 +1,318 @@
#!/usr/bin/env zsh
## configuration file for devuan-live blend
vars+=(username userpass default_shell mkefi grubversion hookscripts)
arrs+=(custom_deb_packages)
blend_name="devuan-minimal-live_"
username="devuan"
userpass="devuan"
default_shell="/bin/bash"
# comment to disable:
#hookscripts="yes"
# uncomment to create uefi-bootable iso
#mkefi="yes"
#efi_work="$BLENDPATH/efi-files"
#grubversion="grub-pc"
#grubversion="grub-efi-amd64"
release="ascii"
version="2.0.0_beta"
mirror="http://devuan.mine.nu/merged"
section="main"
image_name="${os}_${release}_${version}_${arch}_minimal"
base_packages_option=(--no-install-recommends)
extra_packages_option=(--no-install-recommends)
### base package set
minimal_base_packages+=(
acpi
acpi-support-base
acpid
at
bash
bash-completion
bc
busybox
console-common
console-data
console-setup
console-setup-linux
coreutils
dash
dc
dialog
discover
dselect
file
groff-base
info
kbd
laptop-detect
locales
lsof
syslinux
util-linux-locales
zsh
)
## admin package set
minimal_admin_packages+=(
debootstrap
entr
gddrescue
gdisk
htop
iftop
iotop
iw
mtr-tiny
multitail
ncdu
parted
pciutils
psmisc
sudo
time
wavemon
wireless-tools
wpasupplicant
)
## editors package set
minimal_editors_packages+=(
ed
nano
vim-tiny
zile
)
## networking package set
minimal_net_packages+=(
bind9-host
bittornado
curl
dnsutils
edbrowse
fetchmail
ftp
geoip-bin
irssi
lftp
links2
lrzsz
mcabber
minicom
mosh
msmtp
mutt
netcat
net-tools
nfacct
nrss
openssh-client
openssh-server
procmail
rsync
telnet
tin
traceroute
w3m
wget
whois
)
## productivity package set
minimal_prod_packages+=(
abook
apcalc
aspell
aspell-en
calcurse
clex
dvtm
fbi
fbterm
ghostscript
gnupg
gnupg2
gnupg-agent
mc
parallel
poppler-utils
rpl
rename
sc
screen
taskwarrior
tmux
)
## programming package set
minimal_devel_packages+=(
tcc
libc6-dev
m4
patch
perl
perl-base
perl-modules-5.24
python2.7-minimal
python3.5-minimal
gawk
guile-2.0
guile-2.0-libs
)
## games package set
minimal_games_packages+=(
bastet
bombardier
bsdgames
cavezofphear
crawl
curseofwar
empire
freesweep
gnuchess
greed
matanza
moria
nethack-console
ninvaders
omega-rpg
pacman4console
pente
sudoku
)
## accessibility package set
minimal_a11y_packages+=(
beep
brltty
espeak
espeakup
yasr
)
## multimedia package set
minimal_media_packages+=(
alsa-utils
caca-utils
hasciicam
imagemagick
jhead
moc
radio
sox
)
## misc package set
minimal_misc_packages+=(
cmatrix
cowsay
eject
figlet
fortunes-min
fortune-mod
gpm
man-db
manpages
manpages-dev
mlocate
termsaver
toilet
toilet-fonts
ttyrec
unzip
)
### now we include all the package sets
base_packages+=(
$minimal_base_packages
$minimal_admin_packages
$minimal_editors_packages
$minimal_net_packages
$minimal_prod_packages
$minimal_devel_packages
$minimal_games_packages
$minimal_a11y_packages
$minimal_media_packages
$minimal_misc_packages
)
##echo "extra_packages: ${extra_packages}"
#### TODO: ADD setnet
#### TODO: REPLACE twidge (twitter client)
#### TODO: ADD refractasnapshot
#### TODO: ADD refractainstaller
#### TODO: ADD setnet
#### ADDED: geoip-bin
#extra_packages+=(
# b43-fwcutter
# firmware-atheros
# firmware-b43-installer
# firmware-b43legacy-installer
# firmware-bnx2
# firmware-bnx2x
# firmware-brcm80211
# firmware-intelwimax
# firmware-iwlwifi
# firmware-libertas
# firmware-linux-nonfree
# firmware-myricom
# firmware-netxen
# firmware-qlogic
# firmware-ralink
# firmware-realtek
# firmware-ti-connectivity
# firmware-zd1211
#)
purge_packages=(
btrfs-tools
cryptsetup
cryptsetup-bin
debian-keyring
elinks
elinks-data
git
git-core
git-man
liberror-perl
libfsplib0
libtre5
openntpd
tasksel
tasksel-data
vim
vim-runtime
)
# yad needs to be first
#custom_deb_packages+=(yad_0.27.0-1_${arch}.deb)
#
#
#custom_deb_packages+=(
# refractainstaller-base_9.3.0_all.deb
# refractainstaller-gui_9.2.2_all.deb
# refractasnapshot-base_10.0.2_all.deb
# refractasnapshot-gui_10.0.2_all.deb
# setnet_0.3.2-1_all.deb
#)

View File

@ -0,0 +1,325 @@
#!/usr/bin/env zsh
# Copyright (c) 2017 Dyne.org Foundation
# live-sdk is written and maintained by Ivan J. <parazyd@dyne.org>
#
# This file is part of live-sdk
# devuan-minimal-live.blend is maintained by KatolaZ
#
# This source code is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This software is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this source code. If not, see <http://www.gnu.org/licenses/>.
BLENDPATH="${BLENDPATH:-$(dirname $0)}"
source $BLENDPATH/config
blend_preinst() {
fn blend_preinst
req=(blend_name username userpass)
ckreq || return 1
notice "executing $blend_name preinst"
add-user $username $userpass
#notice "copying blend-specific debs"
#cp -fv "$BLENDPATH"/*.deb "$R/extra/custom-packages"
}
blend_postinst() {
fn blend_postinst
req=(strapdir blend_name)
ckreq || return 1
notice "executing $blend_name postinst"
[[ "$mkefi" = "yes" ]] && {
iso_make_efi
iso_write_grub_cfg
}
#install-custdebs || zerr
#pushd "$strapdir"
# sudo rsync -avx --no-o --no-g "$BLENDPATH"/rootfs-overlay/* . || zerr
#popd
blend_finalize || zerr
}
iso_write_isolinux_cfg() {
fn iso_write_isolinux_cfg "(override)"
req=(workdir arch username)
ckreq || return 1
notice "writing isolinux configuration"
cat <<EOF | sudo tee ${workdir}/binary/isolinux/isolinux.cfg >/dev/null
ui vesamenu.c32
prompt 0
menu title devuan-live boot menu
timeout 70
menu background /isolinux/splash.png
menu color title * #FFFFFFFF *
menu color border * #00000000 #00000000 none
menu color sel * #ffffffff #A1B067 *
menu color hotsel 1;7;37;40 #ffffffff #A1B067 *
menu color tabmsg * #E5FD91 #00000000 *
menu color cmdline 0 #E5FD91 #00000000
menu tabmsg Press ENTER to boot or TAB to edit a menu entry
menu vshift 12
menu rows 12
label live
menu label ${os}-live (${arch})
menu default
linux /live/vmlinuz
append initrd=/live/initrd.img boot=live username=${username}
label lang
menu label Other language (TAB to edit)
linux /live/vmlinuz
append initrd=/live/initrd.img boot=live username=${username} hooks=file:///lib/live/mount/medium/live/hooks/fix-lang.sh locales=it_IT.UTF-8
label toram
menu label ${os}-live (${arch}) (load to RAM)
linux /live/vmlinuz
append initrd=/live/initrd.img boot=live username=${username} toram
label failsafe
menu label ${os}-live (${arch}) (failsafe)
kernel /live/vmlinuz noapic noapm nodma nomce nolapic nosmp nomodeset vga=normal
append initrd=/live/initrd.img boot=live
label memtest
menu label Memory test
kernel /live/memtest
endtext
EOF
notice "copying isolinux overlay"
sudo mkdir -p "$workdir"/binary/{live,isolinux}
#sudo cp -rav "$BLENDPATH"/isolinux-overlay/* "$workdir"/binary/isolinux/
#[[ -n "$hookscripts" ]] && {
# sudo cp -av "$BLENDPATH"/hooks "$workdir"/binary/live/
#}
}
# create /boot and /efi for uefi.
# uefi code borrowed and adapted from David Hare, who borrowed and adapted it
# from similar scripts by Colin Watson and Patrick J. Volkerding.
iso_make_efi() {
fn iso_make_efi
req=(workdir efi_work)
ckreq || return 1
notice "creating efi boot files"
tempdir="$(mktemp -d /tmp/work_temp.XXXX)"
# for initial grub.cfg
mkdir -p "$tempdir"/boot/grub
cat >"$tempdir"/boot/grub/grub.cfg <<EOF
search --file --set=root /isolinux/isolinux.cfg
set prefix=(\$root)/boot/grub
source \$prefix/x86_64-efi/grub.cfg
EOF
mkdir -p "$efi_work"
pushd "$efi_work"
# start with empty directories.
rm -rf boot; mkdir -p boot/grub/x86_64-efi
rm -rf efi ; mkdir -p efi/boot
# second grub.cfg file
for i in $(find $strapdir/usr/lib/grub/x86_64-efi -name 'part_*.mod'); do
print "insmod $(basename $i)" >> boot/grub/x86_64-efi/grub.cfg
done
# Additional modules so we don't boot in blind mode.
# I don't know which ones are really needed.
efimods=(
efi_gop
efi_uga
ieee1275_fb
vbe
vga
video_bochs
video_cirrus
jpeg
png
gfxterm
)
for i in $efimods; do
print "insmod $i" >> boot/grub/x86_64-efi/grub.cfg
done
print "source /boot/grub/grub.cfg" >> boot/grub/x86_64-efi/grub.cfg
pushd "$tempdir"
# make a tarred "memdisk" to embed in the grub image
tar -cvf memdisk boot
# make the grub image
grub-mkimage -O "x86_64-efi" -m "memdisk" -o "bootx64.efi" \
-p '(memdisk)/boot/grub' \
search iso9660 configfile normal memdisk tar cat \
part_msdos part_gpt fat ext2 ntfs ntfscomp hfsplus \
chain boot linux
popd
# copy the grub image to efi/boot (to go later in the device's root)
cp "$tempdir"/bootx64.efi efi/boot
# Do the boot image "boot/grub/efiboot.img"
dd if=/dev/zero of=boot/grub/efiboot.img bs=1K count=1440
mkfs.vfat -F 12 boot/grub/efiboot.img
sudo mkdir img-mnt
sudo mount -o loop boot/grub/efiboot.img img-mnt
sudo mkdir -p img-mnt/efi/boot
sudo cp "$tempdir"/bootx64.efi img-mnt/efi/boot/
# copy modules and font
cp $strapdir/usr/lib/grub/x86_64-efi/* boot/grub/x86_64-efi/
# if this doesn't work try another font from the same place (grub's default, unicode.pf2, is much larger)
# Either of these will work, and they look the same to me. Unicode seems to work with qemu. -fsr
# cp /usr/share/grub/ascii.pf2 boot/grub/font.pf2
cp $strapdir/usr/share/grub/unicode.pf2 boot/grub/font.pf2
# copy splash
sudo cp -rav "$BLENDPATH"/isolinux-overlay/splash.png boot/grub/splash.png
# Cleanup efi temps
sudo umount img-mnt
sudo rmdir img-mnt
rm -rf "$tempdir"
popd
# Copy efi files to iso
pushd $workdir
sudo rsync -avx "$efi_work"/boot binary/
sudo rsync -avx "$efi_work"/efi binary/
popd
}
iso_write_grub_cfg() {
fn iso_write_grub_cfg "(override)"
req=(workdir arch username)
ckreq || return 1
notice "writing grub configuration"
# Do the main grub.cfg (which gets loaded last):
cat <<EOF | sudo tee ${workdir}/binary/boot/grub/grub.cfg
if loadfont $prefix/font.pf2 ; then
set gfxmode=640x480
insmod efi_gop
insmod efi_uga
insmod video_bochs
insmod video_cirrus
insmod gfxterm
insmod jpeg
insmod png
terminal_output gfxterm
fi
background_image /boot/grub/splash.png
set menu_color_normal=white/black
set menu_color_highlight=dark-gray/white
set timeout=6
menuentry "${os}-live (${arch})" {
set gfxpayload=keep
linux /live/vmlinuz boot=live username=$username
initrd /live/initrd.img
}
menuentry "Other language" {
set gfxpayload=keep
linux /live/vmlinuz boot=live username=$username hooks=file:///lib/live/mount/medium/live/hooks/fix-lang.sh locales=it_IT.UTF-8
initrd /live/initrd.img
}
menuentry "${os}-live (load to RAM)" {
set gfxpayload=keep
linux /live/vmlinuz boot=live username=$username toram
initrd /live/initrd.img
}
menuentry "${os}-live (failsafe)" {
set gfxpayload=keep
linux /live/vmlinuz boot=live username=$username noapic noapm nodma nomce nolapic nosmp vga=normal
initrd /live/initrd.img
}
menuentry "Memory test" {
linux /live/memtest
}
EOF
}
blend_finalize() {
fn blend_finalize
req=(strapdir username default_shell)
ckreq || return 1
cat <<EOF | sudo tee ${strapdir}/finalize >/dev/null
#!/bin/sh
## permissions
for i in cdrom floppy audio dip video plugdev netdev lpadmin scanner; do
gpasswd -a ${username} \$i
done
chsh -s "${default_shell}" ${username}
chown -R 1000:1000 /home/${username}
cp /home/${username}/Desktop/refractainstaller.desktop /usr/share/applications/
chmod +x /home/${username}/Desktop/refractainstaller.desktop
# This can go away when desktop-base is fixed to do the grub theme.
grep -q GRUB_THEME /etc/default/grub || {
printf "\nGRUB_THEME=/usr/share/desktop-base/grub-themes/desktop-grub-theme/theme.txt\n" >> /etc/default/grub
}
# Not sure if this has been fixed (in devuan-baseconf?)
mv /data/etc/apt/apt.conf.d/05disable-suggests /etc/apt/apt.conf.d/
rm -rf /data
rm -f /etc/fstab
rm -f /etc/popularity-contest.conf
# For ascii if no display manager is used. Maybe this should have a
# contitional that's turned on/off in the config?
# echo "needs_root_rights=yes" >> /etc/X11/Xwrapper.config
# Disable contrib and non-free after installing firmware.
sed -i 's/contrib//g' /etc/apt/sources.list
sed -i 's/non-free//g' /etc/apt/sources.list
## package list
dpkg -l | awk '/^ii/ { print $2 " " $3 }' > /home/${username}/package_list
apt-get update
apt-get clean
updatedb
EOF
chroot-script -d finalize || zerr
}

3
sdk
View File

@ -64,6 +64,7 @@ load() {
blend_map=(
"devuan-live" "$R/blends/devuan-live/devuan-live.blend"
"devuan-minimal-live" "$R/blends/devuan-minimal-live/devuan-minimal-live.blend"
"heads" "$R/../heads.blend"
"decode" "$R/../decode.blend"
)
@ -86,7 +87,7 @@ load() {
source $oslib
[[ -f $blendlib ]] && {
source $blendlib || zerr
act "$os blend leaded"
act "$os blend loaded"
export BLEND=1
}