This is just a proof of concept. Might be useful to notify someone when a system has been booted and reached initramfs, and it is waiting for the decryption pass phrase.
pacman -S screen expect
Huawei MU609
+CMS ERROR: 500
when sending an SMS. # screen /dev/ttyUSB0 115200 at^syscfg=2,2,3FFFFFFF,1,2
/etc/mkinitcpio.conf
:# Load these modules before any boot hooks are run MODULES="ehci_hcd ohci_pci usbserial option ohci_hcd ehci_pci" # Include these binaries BINARIES="/usr/bin/expect /usr/bin/stty" # Include the script and TCL dependency FILES="/usr/lib/tcl8.6/init.tcl /usr/local/bin/init-sms.sh" # Add custom 'sms' hook HOOKS="base udev autodetect modconf block keyboard sms encrypt filesystems fsck"
/usr/lib/initcpio/hooks/sms
:#!/usr/bin/ash run_hook() { /usr/local/bin/init-sms.sh }
/usr/lib/initcpio/install/sms
#!/bin/bash build() { add_runscript }
#!/usr/bin/expect # device set modem /dev/ttyUSB0 # keep it open exec sh -c "sleep 3 < $modem" & # serial port parameters (probably not needed for USB) exec stty -F $modem 9600 raw -clocal -echo -istrip -hup # connect spawn -open [open $modem w+] send "at\r" expect "OK" # Unlock SIM if needed. send "at^cpin?\r" expect { # ^CPIN: SIM PIN,3,10,3,10,3 "*CPIN: SIM PIN*" { send_user "SIM is locked, trying PIN...\n" send "at^cpin=123456\r" expect { "OK" { } "+CME ERROR: incorrect password" { send_user "Wrong PIN, please configure the right PIN.\n" } } } # ^CPIN: READY,,10,3,10,3 "*CPIN: READY*" { send_user "SIM is ready.\n" } } # Wait 5 seconds, device is connecting to network... sleep 5 # set text mode send "at+cmgf=1\r" expect "OK" # set GSM encoding send "at+csmp=,,,0\r" expect "OK" # Configure SMS service center send {AT+CSCA="+31653131313"} send "\r" expect "OK" # Select TE character set send {at+cscs="GSM"} send "\r" expect "OK" # Send SMS to number... send {at+cmgs="0612345678"} send "\r" expect "> " # Text to send, end with \x1A = ctrl-z send "System has reached initramfs." send "\x1a"
mkinitcpio -p linux