diff options
author | Alex Xu (Hello71) <alex_y_xu@yahoo.ca> | 2019-07-26 20:17:54 -0400 |
---|---|---|
committer | Alex Xu (Hello71) <alex_y_xu@yahoo.ca> | 2019-07-26 20:17:54 -0400 |
commit | efd5d866be3cdb9c2b5b3221319fbc80aa0d039b (patch) | |
tree | 5aa6603f47e56bcc380db0274513b95240727e64 /init | |
download | minitramfs-efd5d866be3cdb9c2b5b3221319fbc80aa0d039b.tar.xz minitramfs-efd5d866be3cdb9c2b5b3221319fbc80aa0d039b.zip |
Initial commit
Diffstat (limited to 'init')
-rw-r--r-- | init | 51 |
1 files changed, 51 insertions, 0 deletions
@@ -0,0 +1,51 @@ +#!/bin/sh + +trap 'kill $dropbear_pid; exec sh' EXIT + +case "$PATH" in + */*) ;; + *) export PATH="/usr/sbin:/usr/bin:/sbin:/bin" ;; +esac + +mount -t proc proc /proc +mount -t devtmpfs devtmpfs /dev +mkdir -p /dev/pts +mount -t devpts devpts /dev/pts +mount -t sysfs sysfs /sys + +( +ip link set eth0 up +ip addr add 192.168.0.7/24 dev eth0 +exec dropbear -F -s -p 2222 -K 30 +) & +dropbear_pid=$! + +enc_root=$(findfs UUID=26748575-d7a7-418b-8f68-21be7c937500) || exit +( +amixer sset Master on +amixer sset Master 30% +aplay -Dhw:0,0 /usr/share/sounds/ding.wav +) >/dev/null 2>&1 & +cryptsetup open --tries 65535 --allow-discards "$enc_root" root || [ -e /dev/mapper/root ] || exit + +kill $dropbear_pid +dropbear_pid= + +e2fsck -C 0 -E inode_count_fullmap -p /dev/mapper/root +e2fsck_r=$? +if [ $(( e2fsck_r & 2 )) = 2 ]; then + reboot -f +fi +case "$e2fsck_r" in + 0|1) ;; + *) exit +esac + +mount -o nodev,commit=30 /dev/mapper/root /mnt || exit +cd /mnt +umount /dev/pts +mount --move /dev dev +mount --move /proc proc +mount --move /sys sys + +exec switch_root /mnt /usr/lib/systemd/systemd |