Initial commit

This commit is contained in:
Niles Rogoff 2017-05-13 12:21:25 -04:00
commit 77f5a0c9b8
No known key found for this signature in database
GPG Key ID: B78B908F23430F80
4 changed files with 93 additions and 0 deletions

3
Makefile Normal file
View File

@ -0,0 +1,3 @@
install:
sudo cp hook /usr/lib/initcpio/hooks/myfsck
sudo cp install /usr/lib/initcpio/install/myfsck

1
README Normal file
View File

@ -0,0 +1 @@
run `sudo make install` then add e2fsck to BINARIES, myfsck to HOOKS and i915 and fuse to MODULES in `/etc/mkinitcpio.conf`, then run `mkinitcpio -p linux` or whatever preset you use

65
hook Normal file
View File

@ -0,0 +1,65 @@
#!/usr/bin/ash
run_hook() {
#mkfifo /myfsck
#echo stderr test >&2
#echo Starting tmux
#sleep 1
#LANG=en_US.UTF-8
#TERM=linux
#mkdir /tmp/tmux-0
#tmux new-session "echo MESSAGE HERE!; head -n 1 /myfsck" \; split-window -d "e2fsck -f -y -v -C 0 /dev/sdb2; e2fsck -f -y -v -C 0 /dev/sda5; echo done > /myfsck"
#echo Tmux exited with $?
#rm /myfsck
clear
tput bold
cat /etc/issue.boot
tput sgr0
ROWS=48
size=$(wc -l < /etc/issue.boot)
my_space=$(($ROWS - size - 1))
min() {
test $1 -gt $2 && echo $2 || echo $1
}
tput cup $(($ROWS - $my_space - 1))
for j in $(seq $(tput cols)); do
echo -n '─'
done
touch /myfsck
(e2fsck -f -y -v -C 0 /dev/sdb2; e2fsck -f -y -v -C 0 /dev/sda5; touch /fsck_done) &> /myfsck &
#(e2fsck -f -y -v -C 0 /dev/sdb2; sleep 4; touch /fsck_done) &> /myfsck &
#(for i in $(seq 1 20); do echo $i$'\x0d'end; sleep 1; done; touch /fsck_done) &> /myfsck &
oldlines=0
while ! test -f /fsck_done; do
lines=$(wc -l /myfsck|cut -d " " -f 1)
if test "$lines" -ne "$oldlines"; then
oldlines=$lines
thisone=$my_space
else
thisone=1
fi
for k in $(seq $(min $thisone $(wc -l /myfsck))); do
tput cup $(($ROWS - $k))
msg=$(tail -n $k /myfsck|head -n 1|tr -d '\n'|rev|cut -d $'\x0d' -f 1-2|rev|tr -d $'\x0d')
len=$(($(echo -n $msg|wc -c) - 1))
if test $len -gt $(tput cols); then
msg="LOOOOONG "
len=$(($(echo $msg|wc -c) - 10))
fi
echo -n $msg
for j in $(seq $(($(tput cols) - 1 - $len))); do
echo -n ' '
done
done
sleep .1
done
}
# vim: set ft=sh ts=4 sw=4 et:

24
install Normal file
View File

@ -0,0 +1,24 @@
#!/bin/bash
build() {
add_runscript
#add_binary tmux
#add_binary head
#add_binary mkfifo
add_binary tput
add_binary tr
add_binary rev
add_binary cut
add_file "/usr/share/terminfo/l/linux"
add_file "/etc/issue.boot"
#add_file "/usr/lib/locale/locale-archive"
#add_file "/etc/nsswitch.conf"
}
help() {
cat <<HELPEOF
my fsck script Niles Rogoff 2017
HELPEOF
}
# vim: set ft=sh ts=4 sw=4 et: