Skip to content

Commit

Permalink
Init
Browse files Browse the repository at this point in the history
  • Loading branch information
jaromaz committed Oct 31, 2017
1 parent c7d7ed6 commit 082ff35
Show file tree
Hide file tree
Showing 7 changed files with 418 additions and 0 deletions.
81 changes: 81 additions & 0 deletions prepare.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
#!/bin/sh

# -------------------------------------------------------
# Preparation of the rescshri Linux mini-distribution
# 2017 Jaromaz http://jm.iq.pl
# -------------------------------------------------------

VERSION='1.2'
DEMO=0
CPU=32
HTTPSERVER='http://jm.iq.pl/rescshri/download'

# -------------------------------------------------------

download_unpack () {
echo "Downloading $CPU-bit version:"
cd ./download
wget $HTTPSERVER/rescshri-$VERSION-$CPU-src.tar.gz
tar zxf rescshri-$VERSION-$CPU-src.tar.gz
rm rescshri-$VERSION-$CPU-src.tar.gz
cd ..
}

if [ ! -d 'output' ] ; then
mkdir output
fi

for i in $@
do
case $i in
'redownload')
rm -r download
;;
'livedemo')
DEMO=1
;;
*)
if [ $i -eq 32 -o $i -eq 64 ] ; then
CPU=$i
fi
;;
esac
done

if [ ! -d 'download' ] ; then
mkdir download
fi
if [ ! -d "download/$CPU" ] ; then
download_unpack
fi

# Instalation
rm -r tmp > /dev/null 2>&1
mkdir tmp
cp -r download/$CPU/* tmp
cp -r src/* tmp
rm -r output > /dev/null 2>&1
mkdir output
mv tmp/bzImage output

# Preparation of live demo version
if [ $DEMO -eq 1 ] ; then
mv tmp/usr/share/livedemo/bin/* tmp/usr/bin/
mv tmp/usr/bin/fdisk tmp/usr/share/livedemo/bin/
mv tmp/usr/bin/cfdisk tmp/usr/share/livedemo/bin/
tail +2 tmp/usr/share/livedemo/src/func >> tmp/usr/bin/func
rm tmp/usr/share/livedemo/src/func
tail +3 tmp/usr/bin/rescshri >> tmp/usr/share/livedemo/src/rescshri
mv tmp/usr/share/livedemo/src/* tmp/usr/bin/
else
rm -r tmp/usr/share/livedemo
fi

# Initrd cpio archive
cd ./tmp
find . | cpio --create --format='newc' | gzip > ../output/rescshri.img
cd ..
rm -r tmp

echo "done"

28 changes: 28 additions & 0 deletions src/init
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/sh
# rescshri 1.2 init

export HOME=/home
export PATH=/bin:/sbin:/usr/bin

mountpoint -q proc || mount -t proc proc proc
mountpoint -q sys || mount -t sysfs sys sys


if ! mountpoint -q dev
then
mount -t devtmpfs dev dev || mdev -s
mkdir -p dev/pts
mountpoint -q dev/pts || mount -t devpts dev/pts dev/pts
fi

hostname rescshri

[ -z "$CONSOLE" ] &&
CONSOLE="$(sed -n 's@.* console=\(/dev/\)*\([^ ]*\).*@\2@p' /proc/cmdline)"

[ -z "$HANDOFF" ] && HANDOFF=/bin/sh && rescshri
[ -z "$CONSOLE" ] && CONSOLE=console

exec /sbin/oneit -c /dev/"$CONSOLE" $HANDOFF


234 changes: 234 additions & 0 deletions src/usr/bin/commands
Original file line number Diff line number Diff line change
@@ -0,0 +1,234 @@
#!/bin/sh

. func

COMNS="acpi\
base64\
basename\
blkid\
blockdev\
bunzip2\
bunzip2\
bzcat\
bzcat\
-\
bzip2\
cal\
cat\
catv\
cfdisk\
chattr\
chgrp\
chmod\
chown\
chroot\
chrt\
-\
chvt\
cksum\
clear\
cmp\
comm\
commands\
count\
cp\
cpio\
cut\
date\
df\
-\
dirname\
dmesg\
dos2unix\
du\
e2fsck\
echo\
egrep\
eject\
env\
expand\
-\
factor\
fallocate\
false\
fdisk\
fgrep\
file\
find\
flock\
free\
-\
freeramdisk\
fsfreeze\
fstype\
fsync\
grep\
groups\
gunzip\
gzip\
halt\
-\
head\
help\
hexedit\
hostname\
hush\
hwclock\
id\
ifconfig\
inotifyd\
-\
insmod\
install\
ionice\
iorenice\
iotop\
kill\
killall\
killall5\
link\
-\
ln\
login\
logname\
losetup\
ls\
lsattr\
lsmod\
lspci\
lsusb\
makedevs\
-\
md5sum\
microcom\
mix\
mkdir\
mkfifo\
mknod\
mkpasswd\
mkswap\
mktemp\
-\
modinfo\
mount\
mountpoint\
mv\
nbd-client\
nc\
netcat\
netstat\
nice\
-\
nl\
nohup\
nproc\
od\
oneit\
partprobe\
passwd\
paste\
patch\
pgrep\
-\
pidof\
ping\
pivot_root\
pkill\
pmap\
poweroff\
printenv\
printf\
ps\
-\
pwd\
pwdx\
readahead\
readlink\
realpath\
reboot\
renice\
reset\
-\
resize2fs\
rev\
rfkill\
rm\
rmdir\
rmmod\
route\
sed\
seq\
setsid\
sh\
-\
sha1sum\
shred\
sleep\
sort\
split\
stat\
strings\
su\
swapoff\
swapon\
-\
switch_root\
sync\
sysctl\
tac\
tail\
tar\
taskset\
tee\
time\
timeout\
-\
top\
touch\
true\
truncate\
tty\
tunctl\
tutorial\
umount\
uname\
uniq\
-\
unix2dos\
unlink\
unxz\
uptime\
usleep\
uudecode\
uuencode\
vconfig\
vi\
-\
vmstat\
w\
wc\
wget\
which\
who\
whoami\
xargs\
xxd\
xzcat\
yes\
"

clear
rdwhi "\n\n Currently available commands:\n\n "
rdef
for v in $COMNS
do
if [ $v == "-" ] ; then
printf "\n "
else
rdcya $v
rdef ", "
fi
done

rdcya 'zcat'
rdef ".\n\n"
4 changes: 4 additions & 0 deletions src/usr/share/livedemo/src/cfdisk
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. func
/usr/share/livedemo/bin/cfdisk $@
resdenit
4 changes: 4 additions & 0 deletions src/usr/share/livedemo/src/fdisk
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. func
/usr/share/livedemo/bin/fdisk $@
resdenit
Loading

0 comments on commit 082ff35

Please sign in to comment.