Merge branch 'minimal-dev'

This commit is contained in:
parazyd 2018-06-26 08:52:37 +02:00
commit 24c3ea1eb1
No known key found for this signature in database
GPG Key ID: F0CB28FCF78637DE
18 changed files with 1603 additions and 1 deletions

3
.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
dist/
tmp/
log/

View File

@ -0,0 +1,18 @@
#+TODO: TODO IN-PROGRESS | DONE
* TODO Chec boot_beep (check config files and all!!!)
* DONE remove packages_list from /home/devuan
* DONE Amend motd
* DONE amend isolinux_overlay/isolinux.cfg
** DONE change initrd name
* DONE put correct initrd.img in binary/live/
* DONE Put debs in custom_debs
* TODO Include memtest86+.bin in binary/live/
* DONE put README
* DONE put script to remove firmware packages
* IN-PROGRESS Rebuild all

View File

@ -0,0 +1,295 @@
#!/usr/bin/env zsh
## configuration file for devuan-live blend -- ASCII release
version="2.0.0"
##
## definition of package sets
##
### 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
grub-pc
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
setnet
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
)
#### TODO: REPLACE twidge (twitter client)
#### ADDED: geoip-bin
extra_packages+=(
atmel-firmware
bluez-firmware
dahdi-firmware-nonfree
firmware-amd-graphics
firmware-atheros
firmware-bnx2
firmware-bnx2x
firmware-brcm80211
firmware-cavium
firmware-crystalhd
firmware-intel-sound
firmware-intelwimax
firmware-ipw2x00
firmware-ivtv
firmware-iwlwifi
firmware-libertas
firmware-linux-free
firmware-linux-nonfree
firmware-myricom
firmware-netxen
firmware-qlogic
firmware-realtek
firmware-ti-connectivity
firmware-zd1211
refractainstaller-base
refractasnapshot-base
)
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+=(
## setnet_0.3.2+devuan1.2_all.deb
##)

View File

@ -0,0 +1,58 @@
ui vesamenu.c32
prompt 0
#menu title devuan-live boot menu
#timeout 70
menu background /isolinux/splash.png
menu color title * #ff000000 #00ffffff none
menu color border * #00000000 #00000000 none
menu color sel 1;7;37;30 #ffffffff #ff000000 none
menu color unsel 1;30;37 #ff000000 #ffffffff none
menu color hotsel 1;7;37;40 #ffffffff #76a1d0ff *
menu color tabmsg 1;30;37 #ff000000 #ffffffff none
menu color cmdline 1;30;37 #ff000000 #ffffffff none
menu color help 37;40 #ffdddd00 #00000000 none
menu vshift 8
menu rows 12
#menu helpmsgrow 15
#menu cmdlinerow 25
#menu timeoutrow 26
#menu tabmsgrow 14
menu tabmsg Press ENTER to boot or TAB to edit a menu entry
label std
menu label Devuan Live Minimal (std)
kernel /live/vmlinuz
append initrd=/live/initrd.img boot=live noautologin vga=auto
label accessible
menu label Devuan Live Minimal (access) 
kernel /live/vmlinuz
append initrd=/live/initrd.img boot=live noautologin 4 vga=normal
label std-toram
menu label Devuan Live Minimal (std-toram)
kernel /live/vmlinuz
append initrd=/live/initrd.img boot=live noautologin vga=auto toram
label accessible-toram
menu label Devuan Live Minimal (access-toram) 
kernel /live/vmlinuz
append initrd=/live/initrd.img boot=live noautologin 4 vga=normal toram
label noprobe
menu label Devuan Live Minimal (no probe)
kernel /live/vmlinuz noapic noapm nodma nomce nolapic nosmp vga=normal
append initrd=/live/initrd.img boot=live
label memtest
menu label Memory test
kernel /live/memtest86+.bin
label chain.c32 hd0,0
menu label Boot hard disk
chain.c32 hd0,0
label harddisk
menu label Boot hard disk (old way)
localboot 0x80

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

View File

@ -0,0 +1,74 @@
#/bin/bash
# ----------------------------------------------------------------------
#
# This file is part of microdevuan, a set of scripts to create minimal
# devuan live images
#
# ----------------------------------------------------------------------
#
# This program 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 program 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 program. If not, see <http://www.gnu.org/licenses/>.
#
# ----------------------------------------------------------------------
#
# (c) KatolaZ <katolaz@freaknet.org> (2016)
#
# ----------------------------------------------------------------------
##
## A small daemon that just beeps every second, until the process
## BB_PROCESS is ready...
##
. /etc/default/boot_beep
##
## First, daemonize the script
##
if [ "x$1" != "x--" ]; then
$0 -- 1> /dev/null 2> /dev/null &
exit 0
fi
check_process(){
while [ 1 -gt 0 ]; do
login_ready=`ps ax | grep -E "${BB_PROCESS}" | grep -v "grep" | wc -l`
if [ $((${login_ready})) -ge 1 ]; then
###
### These lines should be put in a separate script, whose name is
### specified in bb_defaults, to allow custom chimes....
###
###
beep -D 50 -l 150 -f 523.25
beep -D 50 -l 150 -f 629.25
beep -D 50 -l 150 -f 784.00
beep -D 50 -l 150 -f 629.25
beep -D 50 -l 150 -f 523.25
exit 0;
else
if [[ ${BB_BOOT_BEEP} = "TRUE" ]]; then
beep -D 100 -l 250 -f 523.25
fi
sleep ${BB_INTERVAL};
fi
done
}
echo $$ >> ${BB_TMPFILE}
check_process

View File

@ -0,0 +1,32 @@
##
## The name of the file which will contain the PID of boot_beep.sh
##
BB_TMPFILE=/tmp/boot_beep.pid
##
## the path to boot_beep.sh
##
BB_SCRIPTFILE=/etc/boot_beep
##
## the process(es) to look for. This pattern will be given to
## "grep -E"...
##
BB_PROCESS="(getty|login)"
##
## Set whether beeps are emitted during boot
##
##
BB_BEEP_BOOT=FALSE
##
## Set check interval
##
##
BB_INTERVAL=1

View File

@ -0,0 +1,132 @@
#!/bin/sh
# ----------------------------------------------------------------------
#
# This file is part of microdevuan, a set of scripts to create minimal
# devuan live images
#
# ----------------------------------------------------------------------
#
# This program 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 program 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 program. If not, see <http://www.gnu.org/licenses/>.
#
# ----------------------------------------------------------------------
#
# (c) KatolaZ <katolaz@freaknet.org> (2016)
#
# ----------------------------------------------------------------------
### BEGIN INIT INFO
# Provides: boot_beep
# Required-Start: mountall
# Required-Stop:
# Default-Start: S
# Default-Stop:
# Short-Description: Boot Beep Daemon
### END INIT INFO
. /etc/default/boot_beep
rm_hanging_instances(){
if [ -f ${BB_TMPFILE} ]; then
for i in `cat ${BB_TMPFILE}`; do
is_alive=`ps ax | grep "^${i} " | wc -l`
if [ $((${is_alive})) -gt 0 ]; then
kill -9 ${i}
fi
done
rm ${BB_TMPFILE}; touch ${BB_TMPFILE}
fi
}
check_active(){
ALIVE=0
if [ -f ${BB_TMPFILE} ]; then
for i in `cat ${BB_TMPFILE}`; do
is_alive=`ps ax | grep "^${i} " | wc -l`
if [ $((${is_alive})) -gt 0 ]; then
ALIVE=1
fi
done
if [ ${ALIVE} -ge 1 ]; then
return 1;
else
return 0;
fi
else
return 0
fi
}
start_bb(){
check_active
if [ $? != 0 ]; then
echo "beep_boot is already running"
exit 1;
fi
rm_hanging_instances
nohup ${BB_SCRIPTFILE} 2>&1 >/dev/null &
exit 0;
}
stop_bb(){
check_active
if [ $? == 0 ]; then
echo "beep_boot is not running"
rm ${BB_TMPFILE}
exit 1;
fi
rm_hanging_instances
exit 0;
}
case $1 in
start)
start_bb
exit 0;
;;
stop)
stop_bb;
exit 0;
;;
status)
check_active
if [ $? == 0 ]; then
echo "boot_beep is not up"
else
echo "boot_beep is up and running"
fi
exit 0
;;
*)
echo "Usage: $0 {start|stop|status}"
exit 1;
esac

View File

@ -0,0 +1,84 @@
# /etc/inittab: init(8) configuration.
# $Id: inittab,v 1.91 2002/01/25 13:35:21 miquels Exp $
# The default runlevel.
id:2:initdefault:
# Boot-time system configuration/initialization script.
# This is run first except when booting in emergency (-b) mode.
si::sysinit:/etc/init.d/rcS
# What to do in single-user mode.
~~:S:wait:/sbin/sulogin
# /etc/init.d executes the S and K scripts upon change
# of runlevel.
#
# Runlevel 0 is halt.
# Runlevel 1 is single-user.
# Runlevels 2-5 are multi-user.
# Runlevel 6 is reboot.
l0:0:wait:/etc/init.d/rc 0
l1:1:wait:/etc/init.d/rc 1
l2:2:wait:/etc/init.d/rc 2
l3:3:wait:/etc/init.d/rc 3
l4:4:wait:/etc/init.d/rc 4
l5:5:wait:/etc/init.d/rc 5
l6:6:wait:/etc/init.d/rc 6
# Normally not reached, but fallthrough in case of emergency.
z6:6:respawn:/sbin/sulogin
# What to do when CTRL-ALT-DEL is pressed.
ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r now
# Action on special keypress (ALT-UpArrow).
#kb::kbrequest:/bin/echo "Keyboard Request--edit /etc/inittab to let this work."
# What to do when the power fails/returns.
pf::powerwait:/etc/init.d/powerfail start
pn::powerfailnow:/etc/init.d/powerfail now
po::powerokwait:/etc/init.d/powerfail stop
# /sbin/getty invocations for the runlevels.
#
# The "id" field MUST be the same as the last
# characters of the device (after "tty").
#
# Format:
# <id>:<runlevels>:<action>:<process>
#
# Note that on most Debian systems tty7 is used by the X Window System,
# so if you want to add more getty's go ahead but skip tty7 if you run X.
#
1:235:respawn:/sbin/getty 38400 tty1
2:23:respawn:/sbin/getty 38400 tty2
3:23:respawn:/sbin/getty 38400 tty3
4:23:respawn:/sbin/getty 38400 tty4
5:23:respawn:/sbin/getty 38400 tty5
6:23:respawn:/sbin/getty 38400 tty6
##
## KatolaZ -- 20160604 -- Accessible runlevel
##
## Runlevel 4 is the "accessible" runlevel. Autologin configured on
## all the ttys. tty1 is root shell
##
a1:4:respawn:/sbin/getty -a root 38400 tty1
a2:4:respawn:/sbin/getty -a devuan 38400 tty2
a3:4:respawn:/sbin/getty -a devuan 38400 tty3
a4:4:respawn:/sbin/getty -a devuan 38400 tty4
a5:4:respawn:/sbin/getty -a devuan 38400 tty5
a6:4:respawn:/sbin/getty -a devuan 38400 tty6
# Example how to put a getty on a serial line (for a terminal)
#
#T0:23:respawn:/sbin/getty -L ttyS0 9600 vt100
#T1:23:respawn:/sbin/getty -L ttyS1 9600 vt100
# Example how to put a getty on a modem line.
#
#T3:23:respawn:/sbin/mgetty -x0 -s 57600 ttyS3

View File

@ -0,0 +1,7 @@
Devuan ASCII 2.0.0 -- Minimal Live
Devuan GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law. 

View File

@ -0,0 +1,2 @@
ctrl_interface=/run/wpa_supplicant
update_config=1

View File

@ -0,0 +1,172 @@
=== Devuan ASCII minimal live ====
This image is a full-featured console-only live Devuan ASCII system,
with tons of command-line and curses utilities and a special focus on
accessibility. The system is a good starting point for a minimalist
environment, a powerful solution for rescue tasks, and a useful tool to
have in your pocket every day.
The image can be burnt on a CDROM or dd-ed on a USB stick.
The regular user is devuan/devuan. Become admin with root/toor.
Designed and maintained by Vincenzo 'Katolaz' Nicosia
Key used to sign: http://pgp.mit.edu/pks/lookup?op=get&search=0x5F20B3AE0B5F062F
Homepage: http://kalos.mine.nu
=======================================
0) Boot options
1) Packages
2) Connecting to the Internet
3) About non-free firmware packages
4) Installing on a hard drive
5) Acknowledgements
=======================================
0) == Boot options ==
There are several boot options available:
- std: default, with selection of framebuffer resolution
- access: accessible boot, with audible boot feedback and autologin
- std-toram: as "std", but load squashfs into RAM
- access-toram: as "access", but load squashfs into RAM
- no probe: disable apic/apm/dma/mce/smp
- memtest: perform a memory test (does not boot Linux)
The two accessible boot options ("access" and "access-toram",
respectively the second and the fourth on the boot menu) emit a "beep"
(CTRL+G) when they are selected, to be easily recognisable, and enter
into a dedicated runlevel (runlevel 4) which autologins root on tty1
and the user devuan on tty2-tty6. There is audible feedback on boot,
and a simple chime (C-E-G-E-C) signals the end of the boot.
=======================================
1) == Packages ===
This image contains around 590 packages in total, and includes:
- _Base system_: bash, busybox, consoledata, GNU coreutils, dash,
dialog, locales, syslinux, sysvinit, util-linux-locales, zsh
- _Admin/Recovery_: debootstrap, entr, gddrescue, gdisk, htop,
iftop, iotop, mtr-tiny, multitail, ncdu, parted, wavemon,
wireless-tools, wpa_supplicant
- _Editors_: vim-tiny, zile (Emacs clone), nano
- _Networking_: bittornado, curl, edbrowse, fetchmail, ftp, irssi,
lftp, links2, mcabber, minicom, mosh, msmtp, mutt, netcat, nrss,
openssh-client, openssh-server, procmail, rsync, setnet, telnet,
tin, twidge, w3m, wget
- _Personal_productivity_: abook, aspell, calcurse, clex, dvtm,
fbi/fbgs, fbterm, ghostscript, gpg, mc, parallel, sc, screen,
taskwarrior, tmux
- _Programming_ languages_: ANSI C (tcc + libc6-dev), Perl
(minimal), python (minimal), awk (gawk), guile
- _Games_: bastet, bombardier, bsdgames, cavezofphear, crawl,
curseofwar, empire, freesweep, gnuchess, greed, matanza, moria,
nethack, ninvaders, omega-rpg, pacman4console, pente, sudoku
- _Accessibility_: beep, brltty, espeak, espeakup, yasr
- _Multimedia_: caca-utils, hasciicam, imagemagick, jhead, moc,
radio, sox
- _Miscellanea_: cmatrix, cowsay, figlet, fortune-mod, gpm,
termsaver, toilet, ttyrec
=======================================
2) == Connecting to the Internet ==
This image ships with "setnet.sh", a simple dialog tool to setup
networking. setnet allows to configure both wired and wireless
connections, with static or DHCP-based IP assignment, and can help you
setting up wi-fi authentication to open, WPA Personal (WPA/PSK and
WPA2/PSK), and WPA Enterprise (WPA/EAP or WPA/TLS) networks.
Just run:
# setnet.sh
from a root console, and then select "Setup interfaces" for a list of
recognised devices. For more information please just:
$ man setnet
=======================================
3) == About non-free firmware packages ==
Devuan minimal live comes with all the available firmware packages
pre-installed. This means that also *non-free* software is present in
this image. Actually, those non-free firmware packages are *the only*
non-free software packages installed in this image.
We highly value the freedom of Devuan users, and we would rather
prefer none of them to be ever forced to use non-free software, at
all. However, the choice of including non-free firmware was dictated
by the necessity to facilitate new users in getting their hardware,
and especially wifi cards, working out of the box.
We provide a simple script, that you can find in
"/root/remove_firmware.sh", which allows to remove all non-free
firmware from your installation. Just run the script, and all non-free
firmware will be removed.
=======================================
4) == Installing on a hard drive ==
The recommended way of installing Devuan is by using one of the
installation media or the desktop-live image available at
http://files.devuan.org under the folders "installer-iso" and
"desktop-live", respectively.
However, it is also possible to install this minimal live image on a
hard disk by using the refractainstaller script shipped with it. I
tested the installation on qemu and on bare-metal, and it worked quite
well, but I cannot guarantee that it will work for you as well, so
please use refractainstaller AT YOUR OWN RISK but feel free to drop me
a line if it works.
Again, INSTALLING AN OPERATING SYSTEM ON AN EXISTING HARD DRIVE MIGHT
POTENTIALLY DESTROY EXISTING DATA, ESPECIALLY IF YOU DON'T KNOW
EXACTLY WHAT YOU ARE DOING. SO PLEASE BE CAREFUL, BACKUP YOUR DATA,
AND DO NOT COMPLAIN IF ANYTHING GOES WRONG. IT WILL BE JUST *YOUR*
FAULT.
=======================================
5) == Acknowledgements ==
I thank the refracta team for providing refractasnapshot and
refractainstaller.
A very special thank goes to Gregory Nowak, Parham Doustdar, Jude
DaShiell, John G Heim, Rob, and all the people in the Linux-speakup
mailing list (http://www.linux-speakup.org/) for their encouragement
and support, and for providing invaluable feedback about
accessibility. Without their help, I couldn't have seen what was
needed in order to make the minimal live images easier to use for
visually-impaired users.
I feel indebted with all the people in the DNG Mailing List who have
provided feedback, suggestions, comments, and encouragement, and in
particular: aitor_czr, Boruch Baum, fsmithred, golinux, David Hare,
Irrwahn, Steve Litt, Daniel Reurich, Joel Roth, Ozi Traveller.
Comments, suggestions, criticisms, and bug reports are welcome, and
should be reported on the official Devuan Bug Tracking System:
http://bugs.devuan.org
=======================================

View File

@ -0,0 +1,20 @@
== About non-free firmware in Devuan minimal-live
Devuan minimal live comes with all the available firmware
packages pre-installed. This means that also *non-free*
software is present in this image. Actually, those non-free
firmware packages are *the only* non-free software packages
installed in this image.
This choice was dictated by the necessity to facilitate
new users in getting their hardware, and expecially wifi
cards, working out of the box.
However, we highly value the freedom of Devuan users, and
we would rather prefer to not be ever forced to use non-free
software, at all.
For this reason, we provide a simple script, called
"remove_firmware.sh", which allows to remove all non-free
firmware from your installation right after boot. Just run
the script, and all non-free firmware will be removed.

View File

@ -0,0 +1,34 @@
#!/bin/sh
##
## Remove all the non-free firmware packages
##
FIRMWARE_PKGS="\
atmel-firmware \
bluez-firmware \
dahdi-firmware-nonfree \
firmware-amd-graphics \
firmware-atheros \
firmware-bnx2 \
firmware-bnx2x \
firmware-brcm80211 \
firmware-cavium \
firmware-crystalhd \
firmware-intel-sound \
firmware-intelwimax \
firmware-iwlwifi \
firmware-libertas \
firmware-linux-nonfree \
firmware-myricom \
firmware-netxen \
firmware-qlogic \
firmware-realtek \
firmware-ti-connectivity \
firmware-zd1211
"
echo "=== removing unwanted firmware packages..."
apt-get autoremove --purge ${FIRMWARE_PKGS}

View File

@ -0,0 +1,237 @@
#!/bin/bash
# ----------------------------------------------------------------------
#
# This file is part of microdevuan, a set of scripts to create minimal
# devuan live images
#
# ----------------------------------------------------------------------
#
# This program 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 program 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 program. If not, see <http://www.gnu.org/licenses/>.
#
# ----------------------------------------------------------------------
#
# (c) KatolaZ <katolaz@freaknet.org> (2016)
#
# ----------------------------------------------------------------------
####
##
## This will create a minimal initrd without too much garbage
##
## KatolaZ -- 2016-05-14
##
##
if [ $# -le 3 ]; then
echo "Usage: $0 <initrd_orig> <initrd_new> <initrd_compression> <initrd_micro>"
exit 1
fi
####
##
## Config options --
##
OLDPWD=`pwd`
INITRD_ORIG=$1
INITRD_NEW=$2
INITRD_COMPR=$3
INITRD_MICRO=$4
WORK_DIR=/tmp/initrd_new
MODULE_DIRS=$(ls lib/modules/)
####
##
## unpack the current initrd image
##
if [ ! -d ${WORK_DIR} ]; then
mkdir ${WORK_DIR}
else
rm -rf ${WORKDIR}/*
fi
####
##
## Determine how the original initrd was compressed...
##
INITRD_FILE=`file -L ${INITRD_ORIG}`
if [ `echo ${INITRD_FILE} | grep gzip | wc -l` == 1 ]; then
INITRD_UNCOMPRESS=zcat;
elif [ `echo ${INITRD_FILE} | grep bzip2 | wc -l` == 1 ]; then
INITRD_UNCOMPRESS=bzcat;
elif [ `echo ${INITRD_FILE} | grep " xz " | wc -l` == 1 ]; then
INITRD_UNCOMPRESS=xzcat;
else
echo "Unable to determine the format of ${INITRD_ORIG} -- Aborting!!!"
exit 1;
fi
echo -n "===> Uncompressing the original init using ${INITRD_UNCOMPRESS}..."
cd ${WORK_DIR}; `${INITRD_UNCOMPRESS} ${INITRD_ORIG} | cpio -id`
echo "done!"
####
##
## Remove unnecessary ethernet modules -- we already know
## that the root partition is not over nfs...
##
for M in ${MODULE_DIRS}; do
echo "===> Removing drivers for kernel version ${M} <==="
MODULE_DIR="lib/modules/${M}/kernel"
echo -n "===> Removing unnecessary network drivers..."
##rm -rf ${MODULE_DIR}/drivers/net/ethernet/*
rm -rf ${MODULE_DIR}/drivers/net/*
echo "done!"
####
##
## Remove unnecessary filesystem support
##
##
echo -n "===> Removing unnecessary filesystems drivers..."
##rm -rf ${MODULE_DIR}/fs/nfs
rm -rf ${MODULE_DIR}/fs/xfs
rm -rf ${MODULE_DIR}/fs/btrfs
##rm -rf ${MODULE_DIR}/fs/ext4
rm -rf ${MODULE_DIR}/fs/fat
rm -rf ${MODULE_DIR}/fs/fuse
rm -rf ${MODULE_DIR}/fs/hfs
rm -rf ${MODULE_DIR}/fs/hfsplus
rm -rf ${MODULE_DIR}/fs/reiserfs
rm -rf ${MODULE_DIR}/fs/ntfs
rm -rf ${MODULE_DIR}/fs/jfs
rm -rf ${MODULE_DIR}/fs/jffs2
rm -rf ${MODULE_DIR}/fs/udf
rm -rf ${MODULE_DIR}/fs/nls
rm -rf ${MODULE_DIR}/fs/nfs_common
echo "done!"
####
##
## Remove the lftp and qla2xxx drivers (FibreChannel)
##
echo -n "===> Removing unnecessary SCSI drivers..."
rm -rf ${MODULE_DIR}/drivers/scsi/lpfc
rm -rf ${MODULE_DIR}/drivers/scsi/qla2xxx
rm -rf ${MODULE_DIR}/drivers/scsi/fnic
rm -rf ${MODULE_DIR}/drivers/scsi/csiostor
rm -rf ${MODULE_DIR}/drivers/scsi/isci
rm -rf ${MODULE_DIR}/drivers/scsi/cxgbi
rm -rf ${MODULE_DIR}/drivers/scsi/megaraid
rm -rf ${MODULE_DIR}/drivers/scsi/mpt2sas
rm -rf ${MODULE_DIR}/drivers/scsi/mpt3sas
rm -rf ${MODULE_DIR}/drivers/scsi/pm8001
rm -rf ${MODULE_DIR}/drivers/scsi/qla4xxx
rm -rf ${MODULE_DIR}/drivers/scsi/aic7xxx
rm -rf ${MODULE_DIR}/drivers/scsi/bfa
echo "done!"
## remove the gpu driver folder altogether
echo -n "===> Removing unnecessary GPU drivers..."
rm -rf ${MODULE_DIR}/drivers/gpu/
echo "done"
echo -n "===> Removing unnecessary firmware..."
rm -rf ${MODULE_DIR}/firmware/radeon/
rm -rf ${MODULE_DIR}/firmware/cxgb4
echo "done"
done
##
## Remove unnecessary stuff in /bin and /sbin
##
echo -n "===> Removing unnecessary stuff in /bin and /sbin..."
#rm -rf bin/rsync bin/wget
#rm -rf sbin/acpid
#rm -rf lib/systemd
echo "done!"
####
##
## Maybe we might remove everything in usr/lib
##
echo -n "===> Removing unnecessary libraries in /usr/lib..."
##rm -rf usr/lib/*
echo "done!"
####
####
##
## Now we create the micro initrd
##
cat <<EOF
*************************************************************************
** WARNING!!!! DO NOT INTERRUPT THE CREATION OF INITRD OR YOUR IMAGE **
** WILL COME OUT COMPLETELY BROKEN (AND YOU MIGHT NEED TO START FROM **
** SCRATCH!!!) **
*************************************************************************
EOF
echo -n "===> Creating new initrd '${INITRD_MICRO}' using ${INITRD_COMPR}..."
find . | cpio -H newc -o | `echo ${INITRD_COMPR}` > ${INITRD_MICRO}
echo -n "done!"
####
##
## Remove the directory
##
cd ${OLDPWD} && rm -rf ${WORK_DIR}
exit 0

View File

@ -0,0 +1,46 @@
#!/usr/bin/env zsh
## configuration file for devuan-minimal-live blend
vars+=(username userpass default_shell mkefi grubversion hookscripts)
arrs+=(custom_deb_packages)
blend_name="devuan-minimal-live_"
release="ascii"
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"
mirror="http://pkgmaster.devuan.org/merged"
section="main contrib non-free"
base_packages_option=(--no-install-recommends)
extra_packages_option=(--no-install-recommends)
release_conf="$BLENDPATH/$release/config"
### package sets are defined in the corresponding $release/config file
source $release_conf
## image_name depends on release and version
image_name="${os}_${release}_${version}_${arch}_minimal"

View File

@ -0,0 +1,381 @@
#!/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 <katolaz@freaknet.org>
#
# 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_release_path=$BLENDPATH/$release/
blend_scripts=${blend_release_path}/scripts
###source $BLENDPATH/$release/devuan-minimal-live.release
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 into $R/extra/custom-packages"
## No more custom-packages
##cp -fv "$blend_release_path"/custom_debs/*.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
}
## TODO: ENABLE THIS
install-custdebs || zerr
pushd "$strapdir"
sudo rsync -avx --no-o --no-g "$blend_release_path"/rootfs_overlay/* . || zerr
sudo chmod 755 etc/init.d/boot_beep
popd
blend_finalize || zerr
}
iso_write_isolinux_cfg() {
fn iso_write_isolinux_cfg "(override)"
req=(workdir arch username)
ckreq || return 1
notice "copying isolinux overlay"
sudo mkdir -p "$workdir"/binary/{live,isolinux}
sudo cp -rav "$blend_release_path"/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 "$blend_release_path"/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
}
## UNUSED
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
}
## put the "create_initrd.sh" script
##func
put_create_initrd(){
sudo cp ${blend_scripts}/create_initrd.sh ${strapdir}/ >/dev/null
## Now we make it executable
sudo chmod 755 ${strapdir}/create_initrd.sh
}
## put the "finalize" script, that does the final work
## func
put_finalize(){
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}
# 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
## Disable updates
sed -i '/-updates/s/^/## /g' /etc/apt/sources.list
## insert service boot_beep
insserv boot_beep
## Configure framebuffer
setcap 'cap_sys_tty_config+ep' /usr/bin/fbterm
chmod u+s /usr/bin/fbterm
## Make initramfs
SLIM_INITRD=initrd_devuan.img
MICRO_INITRD=/boot/initrd.img
INITRD_COMPR="xz --check=crc32 --x86 -6 -"
/create_initrd.sh /initrd.img /boot/\${SLIM_INITRD} \
"\${INITRD_COMPR}" \${MICRO_INITRD}
rm -f $(realpath /initrd.img)
rm -f $(realpath /initrd.img.old)
echo "====> Content of /boot before rm:"
ls /boot
rm -f /initrd.img
rm -f /initrd.img.old
KERN_ORIG=\$(ls /boot/initrd.img-* | head -1 | cut -d "-" -f 2-)
rm -f /boot/initrd.img-*
echo "====> Content of /boot AFTER rm:"
ls /boot
ln -s \${MICRO_INITRD} /initrd.img
## rm create_initrd.sh
rm /create_initrd.sh
## install additional packages
cd /custom-packages
dpkg -i \$(find ./ -type f -name '*.deb')
## package list
#dpkg -l | awk '/^ii/ { print $2 " " $3 }' > /home/${username}/package_list
##apt-get update
apt-get clean
rm /var/cache/apt/*.bin
updatedb
rm -f /initrd.img
rm -f /initrd.img.old
rm -f /boot/initrd.img-*
ln -s \${MICRO_INITRD} /initrd.img
ln -s \${MICRO_INITRD} /boot/initrd.img-\${KERN_ORIG}
EOF
## cp ${strapdir}/finalize ${strapdir}/finalize.bak
}
## func
# put_packages(){
# sudo cp -a "$R/extra/custom-packages/" ${strapdir}
# }
blend_finalize() {
fn blend_finalize
req=(strapdir username default_shell)
ckreq || return 1
put_create_initrd
#put_packages
put_finalize
#chroot-script -d finalize || zerr
chroot-script finalize || zerr
printf "copying ${strapdir}/boot/initrd.img to ${workdir}/binary/live/..."
sudo cp -L ${strapdir}/boot/initrd.img ${workdir}/binary/live/
echo "done"
}

9
sdk
View File

@ -30,6 +30,7 @@ source $R/lib/zuper/zuper
vars+=(livesdk_version)
vars+=(R workdir strapdir)
vars+=(os oslib blendlib)
vars+=(release)
vars+=(MAKEOPTS)
## global arrs
@ -49,6 +50,9 @@ load() {
os="$1"
arch="$2"
blend="$3"
[[ $# -gt 3 ]] && release="$4"
req=(os arch)
ckreq || return 1
@ -64,6 +68,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 +91,7 @@ load() {
source $oslib
[[ -f $blendlib ]] && {
source $blendlib || zerr
act "$os blend leaded"
act "$os blend loaded -- ($blend -- release: $release)"
export BLEND=1
}
@ -104,3 +109,5 @@ TRAPZERR() { zerr; return $? }
notice "live-sdk loaded"
export PROMPT="%F{yellow}%(?..%? )%{$reset_color%}livesdk@%{$fg[red]%}%m %{$reset_color%} %{$fg[blue]%}%#%{$fg_bold[blue]%}%{$reset_color%} "
echo "release is: $release"