Compare commits

...

2 Commits

Author SHA1 Message Date
Noah 16fbf5dc41 jmms wrappers/helpers 2021-01-22 02:50:55 +00:00
Noah b3dbe43239 mms-check script 2021-01-19 19:39:03 -08:00
3 changed files with 79 additions and 0 deletions

38
change-username.sh Executable file
View File

@ -0,0 +1,38 @@
#!/bin/bash
# A script to change the current username
# Get current username
printf "\nType the current username:\n"
read old
# Set desired username
printf "\nType the desired username:\n"
read new
# Home paths
ohp="home/$old"
nhp="home/$new"
# Change username
printf "\nChanging username\n"
for file in group gshadow passwd shadow subgid subuid
do
sed -i "s/$old/$new/g" /etc/$file*
done
# Rename home folder
mv /$ohp /$nhp
# Fix path references in /home for new user
printf "\nAdjusting paths in home directory\n"
grep -rl "$ohp" /$nhp | xargs sed -i "s+$ohp+$nhp+g"
# Set user info
echo
chfn $new
sync
reboot

30
mms-check Executable file
View File

@ -0,0 +1,30 @@
#!/usr/bin/perl
# Check ModemManager for pending SMS/MMS messages clogging its queue.
# Until mobile Linux natively supports MMS messages, ModemManager is
# needed along with Janky MMS (https://git.sr.ht/~amindfv/jmms) to get
# your messages and flush the queue; if the queue gets clogged you don't
# get incoming messages anymore.
# Usage: run this in your .bashrc so it'll print in your new terminal
# session to remind you that messages are pending.
use 5.12.0;
use strict;
use warnings;
# Find modem ID
my $modem;
my $list = `mmcli -L`;
if ($list =~ m{/Modem/(\d+)}i) {
$modem = $1;
} else {
die "didn't find modem id";
}
my $chk = `mmcli -m $modem --messaging-list-sms`;
my @lines = split(/\n/, $chk);
if ($chk !~ /no sms messages were found/i) {
say "Notice: mmcli shows there are pending SMS messages:";
say $chk;
}

11
mms-read Executable file
View File

@ -0,0 +1,11 @@
#!/bin/bash
# Wrapper for Jenky MMS (https://git.sr.ht/~amindfv/jmms)
# Until MMS is natively supported in mobile Linux, this command
# will use jmms to read your pending MMS messages. For this to
# work the WiFi needs switched off as only the 4G LTE connection
# has authentication to read from (T-Mobile's) servers.
sudo nmcli radio wifi off
jmms --get
sudo nmcli radio wifi on