-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
7 changed files
with
418 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/sh | ||
. func | ||
/usr/share/livedemo/bin/cfdisk $@ | ||
resdenit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/sh | ||
. func | ||
/usr/share/livedemo/bin/fdisk $@ | ||
resdenit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
#!/bin/sh | ||
|
||
# Livedemo location | ||
LD='/usr/share/livedemo'; | ||
|
||
# Virtual HDD location | ||
FHDD="$LD/hdd/hda.img" | ||
|
||
# Virtual HDD initialization | ||
resinit () { | ||
|
||
losetup --partscan --show --find $FHDD > /dev/null 2>&1 | ||
|
||
# Virtual partitions - maximum 5 | ||
ln -n /dev/loop0 /dev/hda > /dev/null 2>&1 | ||
for i in 1 2 3 4 5 | ||
do | ||
ln -n /dev/loop0p$i /dev/hda$i > /dev/null 2>&1 | ||
done | ||
} | ||
|
||
# Virtual HDD reinitialization | ||
resdenit () { | ||
|
||
# Removing fake hdd | ||
rm /dev/hda > /dev/null 2>&1 | ||
for i in 1 2 3 4 5 | ||
do | ||
rm /dev/hda$i > /dev/null 2>&1 | ||
done | ||
|
||
# Detaching the loop device | ||
losetup -d /dev/loop0 > /dev/null 2>&1 | ||
sleep 1 | ||
|
||
# Resinit call | ||
resinit | ||
} | ||
|
||
|
||
# Image file creation | ||
hdd_image () { | ||
printf "Setting up a virtual hard drive /dev/hda ." | ||
dd if=/dev/zero of=$FHDD bs=1024 count=6144 > /dev/null 2>&1 | ||
printf "." | ||
printf "n\np\n\n\n\nw\n" | $LD/bin/fdisk $FHDD > /dev/null 2>&1 | ||
printf "." | ||
resinit | ||
printf "." | ||
mkfs.ext4 /dev/loop0p1 > /dev/null 2>&1 | ||
printf ". " | ||
resdenit | ||
printf "done.\n" | ||
sleep 1 | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/bin/sh | ||
|
||
. func | ||
if [ ! -f $FHDD ] ; then | ||
dmesg -n 1 | ||
hdd_image | ||
mount /dev/hda1 /mnt | ||
fi | ||
|
||
|