Syncing state

This commit is contained in:
DarkFeather 2018-12-11 17:07:05 -06:00
parent 2398d69139
commit 30c6c5791b
10 changed files with 122 additions and 790 deletions

111
Admin/netcli Executable file
View File

@ -0,0 +1,111 @@
#!/bin/bash
# Global variables
unset conf
unset network
unset type
interface="wlp4s0"
# Print helptext
function usage() {
echo Usage: $0 '[-i interface] -f conf_name'
echo " $0 -a # Connect to any known secured network"
echo " $0 -l # List networks and arp"
echo " $0 -o SSID # Connect to open network "
echo " $0 -u # Bring up interface"
echo " $0 -d # Stop the interface"
echo " $0 -I # Info "
echo " $0 -h # Usage"
echo
echo Add -v to increase verbosity.
echo "Add -t TYPE to override type guessing, where type is eth or wifi"
echo Default interface is "${interface}"
}
# Try to guess if we're ether or wifi
function guessType() {
if [ "$(echo "${interface}" | egrep -c '^enp|^eth|^eno')" -ne 1 ]; then
echo "wifi"
else
echo "ether"
fi
}
# Clean up running processes
function cleanUp() {
killall wpa_supplicant dhcpcd 2>&1
ip link set "$interface" down
}
# Connect to a given open network
# param network: an open ESSID
function connectOpen() {
network="$1"
cleanUp
ip link set "$interface" up
if [ "$type" == "wifi" ]; then
iw dev "$interface" connect "$network"
fi
}
# Connect to any known secured access point
function connectAny() {
cleanUp
ip link set "$interface" up
if [ "$type" == "wifi" ]; then
for i in `iwlist "$interface" scanning | grep ESSID | cut -f 2 -d \" | tr '[:upper:]' '[:lower:]'`; do
if [ -f /etc/wpa_supplicant/"$i".conf ]; then
/root/bin/wifi "$i" "$interface"
if [ $? -eq 0 ]; then
exit 0;
fi
fi
done
fi
}
# Connect using the WPA Conf file saved
# param conf: the conf file
function connect() {
conf="$1"
cleanUp
ip link set "${interface}" up
if [ "$type" == wifi ]; then
wpa_supplicant -i "$interface" -c "$conf" -B
fi
}
# Get the information on current interfaces
function netInfo() {
ip addr list
ip route list
iwlist scanning
}
### MAIN FUNCTION ###
if [ `echo "$0" | egrep -c '(^|/)netcli$'` -eq 1 ]; then
type=`guessType`
while getopts 'adf:hIi:lo:t:uv' OPTION 2>/dev/null; do
case "${OPTION}" in
a) connectAny ;;
f) connect "/etc/wpa_supplicant/${OPTARG}.conf" ;;
d) cleanUp; exit 0 ;;
h) usage; exit 0 ;;
i) interface="${OPTARG}"; type=`guessType` ;;
I) netInfo; exit 0; ;;
l) if [ "$type" == "wifi" ]; then echo SSID Broadcasts:; iwlist "${interface}" scanning | egrep Encryption\|ESSID | sed 's/ *//' | sed 's/ESSID://' ; fi; echo; echo ARP list:; arp -a; exit $? ;;
o) connectOpen "${OPTARG}" ;;
t) if [ "$OPTARG" != "wifi" ] && [ "$OPTARG" != "eth" ]; then usage; exit 1; fi; type="${OPTARG}" ;;
u) if ! [ "$(ip link list "${interface}" | grep -m 1 -c \ UP\ )" -ne 1 ]; then ip link set "${interface}" up; fi ;;
v) set -x ;;
*) usage; exit 1 ;;
esac
done
# Attempt DHCP Lease -- if this fails, static routing will need to be added TODO
sleep 3
dhcpcd "$interface"
exit $?
fi

View File

@ -1,16 +0,0 @@
#!/bin/bash
if [ -z "$1" ]; then
echo Usage: $0 conf_name '[ interface ]'
exit 1;
else
conf="$1"
fi
if [ -z "$2" ]; then
interface="wlp4s0"
else
interface="$2"
fi
wpa_supplicant -i "$interface" -c /etc/wpa_supplicant/"${conf}".conf -B
sleep 3
dhcpcd "$interface"
exit $?

View File

@ -1,13 +0,0 @@
#!/bin/bash
MAC="34:f6:4b:36:12:8f"
interface=`ip link list | grep -B 1 "$MAC" | head -n 1 | cut -f 2 -d ':' | cut -f 2 -d ' '`
ip link set "$interface" up
for i in `iwlist "$interface" scanning | grep ESSID | cut -f 2 -d \" | tr '[:upper:]' '[:lower:]'`; do
if [ -f /etc/wpa_supplicant/"$i".conf ]; then
/root/bin/wifi "$i" "$interface"
if [ $? -eq 0 ]; then
exit 0;
fi
fi
done

View File

@ -1,294 +0,0 @@
# When testing changes, the easiest way to reload the theme is with /RELOAD.
# This reloads the configuration file too, so if you did any changes remember
# to /SAVE it first. Remember also that /SAVE overwrites the theme file with
# old data so keep backups :)
# TEMPLATES:
# The real text formats that irssi uses are the ones you can find with
# /FORMAT command. Back in the old days all the colors and texts were mixed
# up in those formats, and it was really hard to change the colors since you
# might have had to change them in tens of different places. So, then came
# this templating system.
# Now the /FORMATs don't have any colors in them, and they also have very
# little other styling. Most of the stuff you need to change is in this
# theme file. If you can't change something here, you can always go back
# to change the /FORMATs directly, they're also saved in these .theme files.
# So .. the templates. They're those {blahblah} parts you see all over the
# /FORMATs and here. Their usage is simply {name parameter1 parameter2}.
# When irssi sees this kind of text, it goes to find "name" from abstracts
# block below and sets "parameter1" into $0 and "parameter2" into $1 (you
# can have more parameters of course). Templates can have subtemplates.
# Here's a small example:
# /FORMAT format hello {colorify {underline world}}
# abstracts = { colorify = "%G$0-%n"; underline = "%U$0-%U"; }
# When irssi expands the templates in "format", the final string would be:
# hello %G%Uworld%U%n
# ie. underlined bright green "world" text.
# and why "$0-", why not "$0"? $0 would only mean the first parameter,
# $0- means all the parameters. With {underline hello world} you'd really
# want to underline both of the words, not just the hello (and world would
# actually be removed entirely).
# COLORS:
# You can find definitions for the color format codes in docs/formats.txt.
# There's one difference here though. %n format. Normally it means the
# default color of the terminal (white mostly), but here it means the
# "reset color back to the one it was in higher template". For example
# if there was /FORMAT test %g{foo}bar, and foo = "%Y$0%n", irssi would
# print yellow "foo" (as set with %Y) but "bar" would be green, which was
# set at the beginning before the {foo} template. If there wasn't the %g
# at start, the normal behaviour of %n would occur. If you _really_ want
# to use the terminal's default color, use %N.
#############################################################################
# default foreground color (%N) - -1 is the "default terminal color"
default_color = "-1";
# print timestamp/servertag at the end of line, not at beginning
info_eol = "false";
# these characters are automatically replaced with specified color
# (dark grey by default)
replaces = { "[]=" = "%W$*%n"; };
abstracts = {
##
## generic
##
# text to insert at the beginning of each non-message line
line_start = "%B-%n!%B-%n ";
# timestamp styling, nothing by default
timestamp = "%r$*%n";
# any kind of text that needs hilighting, default is to bold
hilight = "%_$*%_";
# any kind of error message, default is bright red
error = "%R$*%n";
# channel name is printed
channel = "%_$*%_";
# nick is printed
nick = "%_$*%_";
# nick host is printed
nickhost = "[$*]";
# server name is printed
server = "%_$*%_";
# some kind of comment is printed
comment = "[$*]";
# reason for something is printed (part, quit, kick, ..)
reason = "{comment $*}";
# mode change is printed ([+o nick])
mode = "{comment $*}";
##
## channel specific messages
##
# highlighted nick/host is printed (joins)
channick_hilight = "%C$*%n";
chanhost_hilight = "{nickhost %c$*%n}";
# nick/host is printed (parts, quits, etc.)
channick = "%c$*%n";
chanhost = "{nickhost $*}";
# highlighted channel name is printed
channelhilight = "%c$*%n";
# ban/ban exception/invite list mask is printed
ban = "%c$*%n";
##
## messages
##
# the basic styling of how to print message, $0 = nick mode, $1 = nick
msgnick = "%W<%n$0$1-%W>%n %|";
# message from you is printed. "msgownnick" specifies the styling of the
# nick ($0 part in msgnick) and "ownmsgnick" specifies the styling of the
# whole line.
# Example1: You want the message text to be green:
# ownmsgnick = "{msgnick $0 $1-}%g";
# Example2.1: You want < and > chars to be yellow:
# ownmsgnick = "%Y{msgnick $0 $1-%Y}%n";
# (you'll also have to remove <> from replaces list above)
# Example2.2: But you still want to keep <> grey for other messages:
# pubmsgnick = "%W{msgnick $0 $1-%W}%n";
# pubmsgmenick = "%W{msgnick $0 $1-%W}%n";
# pubmsghinick = "%W{msgnick $1 $0$2-%n%W}%n";
# ownprivmsgnick = "%W{msgnick $*%W}%n";
# privmsgnick = "%W{msgnick %R$*%W}%n";
# $0 = nick mode, $1 = nick
ownmsgnick = "{msgnick $0 $1-}";
ownnick = "%_$*%n";
# public message in channel, $0 = nick mode, $1 = nick
pubmsgnick = "{msgnick $0 $1-}";
pubnick = "%N$*%n";
# public message in channel meant for me, $0 = nick mode, $1 = nick
pubmsgmenick = "{msgnick $0 $1-}";
menick = "%Y$*%n";
# public highlighted message in channel
# $0 = highlight color, $1 = nick mode, $2 = nick
pubmsghinick = "{msgnick $1 $0$2-%n}";
# channel name is printed with message
msgchannel = "%W:%c$*%n";
# private message, $0 = nick, $1 = host
privmsg = "[%R$0%W(%r$1-%W)%n] ";
# private message from you, $0 = "msg", $1 = target nick
ownprivmsg = "[%r$0%W(%R$1-%W)%n] ";
# own private message in query
ownprivmsgnick = "{msgnick $*}";
ownprivnick = "%_$*%n";
# private message in query
privmsgnick = "{msgnick %R$*%n}";
##
## Actions (/ME stuff)
##
# used internally by this theme
action_core = "%_ * $*%n";
# generic one that's used by most actions
action = "{action_core $*} ";
# own action, both private/public
ownaction = "{action $*}";
# own action with target, both private/public
ownaction_target = "{action_core $0}%W:%c$1%n ";
# private action sent by others
pvtaction = "%_ (*) $*%n ";
pvtaction_query = "{action $*}";
# public action sent by others
pubaction = "{action $*}";
##
## other IRC events
##
# whois
whois = "%# $[8]0 : $1-";
# notices
ownnotice = "[%r$0%W(%R$1-%W)]%n ";
notice = "%W-%M$*%W-%n ";
pubnotice_channel = "%W:%m$*";
pvtnotice_host = "%W(%m$*%W)";
servernotice = "%g!$*%n ";
# CTCPs
ownctcp = "[%r$0%W(%R$1-%W)] ";
ctcp = "%g$*%n";
# wallops
wallop = "%_$*%n: ";
wallop_nick = "%n$*";
wallop_action = "%_ * $*%n ";
# netsplits
netsplit = "%R$*%n";
netjoin = "%C$*%n";
# /names list
names_prefix = "";
names_nick = "[%_$0%_$1-] ";
names_nick_op = "{names_nick $*}";
names_nick_halfop = "{names_nick $*}";
names_nick_voice = "{names_nick $*}";
names_users = "[%g$*%n]";
names_channel = "%G$*%n";
# DCC
dcc = "%g$*%n";
dccfile = "%_$*%_";
# DCC chat, own msg/action
dccownmsg = "[%r$0%W($1-%W)%n] ";
dccownnick = "%R$*%n";
dccownquerynick = "%_$*%n";
dccownaction = "{action $*}";
dccownaction_target = "{action_core $0}%W:%c$1%n ";
# DCC chat, others
dccmsg = "[%G$1-%W(%g$0%W)%n] ";
dccquerynick = "%G$*%n";
dccaction = "%_ (*dcc*) $*%n %|";
##
## statusbar
##
# default background for all statusbars. You can also give
# the default foreground color for statusbar items.
sb_background = "%0%r";
# default backround for "default" statusbar group
#sb_default_bg = "%1";
# background for prompt / input line
sb_prompt_bg = "%n";
# background for info statusbar
sb_info_bg = "%8";
# background for topicbar (same default)
#sb_topic_bg = "%1";
# text at the beginning of statusbars. sb-item already puts
# space there,so we don't use anything by default.
sbstart = "";
# text at the end of statusbars. Use space so that it's never
# used for anything.
sbend = " ";
topicsbstart = "{sbstart $*}";
topicsbend = "{sbend $*}";
prompt = "$* %r|%n> ";
sb = " %r[%n$*%r]%n";
sbmode = "(+%W$*%n)";
sbaway = " (%RzZzZ%n)";
sbservertag = ":$0 (change with ^X)";
sbnickmode = "$0";
# activity in statusbar
# ',' separator
sb_act_sep = "%W$*";
# normal text
sb_act_text = "%W$*";
# public message
sb_act_msg = "%W$*";
# hilight
sb_act_hilight = "%W$*";
# hilight with specified color, $0 = color, $1 = text
sb_act_hilight_color = "$0$1-%n";
};

View File

@ -1,295 +0,0 @@
servers = (
{
address = "IRCADDRESS";
chatnet = "NETWORKNAME";
port = "IRCPORT";
autoconnect = "yes";
ssl_verify = "no";
use_ssl = "yes";
},
);
chatnets = {
NETWORKNAME = {
type = "IRC";
autosendcmd = "/MSG NickServ identify NICKSERVPASS";
max_kicks = "1";
max_msgs = "4";
max_whois = "1";
};
};
channels = (
{ name = "CHANNELNAME"; chatnet = "NETWORKNAME"; autojoin = "Yes"; },
);
aliases = {
ATAG = "WINDOW SERVER";
ADDALLCHANS = "SCRIPT EXEC foreach my \\$channel (Irssi::channels()) { Irssi::command(\"CHANNEL ADD -auto \\$channel->{name} \\$channel->{server}->{tag} \\$channel->{key}\")\\;}";
B = "BAN";
BACK = "AWAY";
BANS = "BAN";
BYE = "QUIT";
C = "CLEAR";
CALC = "EXEC - if command -v bc >/dev/null 2>&1\\; then printf '%s=' '$*'\\; echo '$*' | bc -l\\; else echo bc was not found\\; fi";
CHAT = "DCC CHAT";
CUBES = "SCRIPT EXEC Irssi::active_win->print(\"%_bases\", MSGLEVEL_CLIENTCRAP) \\; Irssi::active_win->print( do { join '', map { \"%x0\\${_}0\\$_\" } '0'..'9','A'..'F' }, MSGLEVEL_NEVER | MSGLEVEL_CLIENTCRAP) \\; Irssi::active_win->print(\"%_cubes\", MSGLEVEL_CLIENTCRAP) \\; Irssi::active_win->print( do { my \\$y = \\$_*6 \\; join '', map { my \\$x = \\$_ \\; map { \"%x\\$x\\$_\\$x\\$_\" } @{['0'..'9','A'..'Z']}[\\$y .. \\$y+5] } 1..6 }, MSGLEVEL_NEVER | MSGLEVEL_CLIENTCRAP) for 0..5 \\; Irssi::active_win->print(\"%_grays\", MSGLEVEL_CLIENTCRAP) \\; Irssi::active_win->print( do { join '', map { \"%x7\\${_}7\\$_\" } 'A'..'X' }, MSGLEVEL_NEVER | MSGLEVEL_CLIENTCRAP) \\; Irssi::active_win->print(\"%_mIRC extended colours\", MSGLEVEL_CLIENTCRAP) \\; my \\$x \\; \\$x .= sprintf \"\00399,%02d%02d\",\\$_,\\$_ for 0..15 \\; Irssi::active_win->print(\\$x, MSGLEVEL_NEVER | MSGLEVEL_CLIENTCRAP) \\; for my \\$z (0..6) { my \\$x \\; \\$x .= sprintf \"\00399,%02d%02d\",\\$_,\\$_ for 16+(\\$z*12)..16+(\\$z*12)+11 \\; Irssi::active_win->print(\\$x, MSGLEVEL_NEVER | MSGLEVEL_CLIENTCRAP) }";
DATE = "TIME";
DEHIGHLIGHT = "DEHILIGHT";
DESCRIBE = "ACTION";
DHL = "DEHILIGHT";
EXEMPTLIST = "MODE $C +e";
EXIT = "QUIT";
GOTO = "SCROLLBACK GOTO";
HIGHLIGHT = "HILIGHT";
HL = "HILIGHT";
HOST = "USERHOST";
INVITELIST = "MODE $C +I";
J = "JOIN";
K = "KICK";
KB = "KICKBAN";
KN = "KNOCKOUT";
LAST = "LASTLOG";
LEAVE = "PART";
M = "MSG";
MUB = "UNBAN *";
N = "NAMES";
NMSG = "^MSG";
P = "PART";
Q = "QUERY";
RESET = "SET -default";
RUN = "SCRIPT LOAD";
SAY = "MSG *";
SB = "SCROLLBACK";
SBAR = "STATUSBAR";
SIGNOFF = "QUIT";
SV = "MSG * Irssi $J ($V) - http://www.irssi.org";
T = "TOPIC";
UB = "UNBAN";
UMODE = "MODE $N";
UNSET = "SET -clear";
W = "WHO";
WC = "WINDOW CLOSE";
WG = "WINDOW GOTO";
WJOIN = "JOIN -window";
WI = "WHOIS";
WII = "WHOIS $0 $0";
WL = "WINDOW LIST";
WN = "WINDOW NEW HIDDEN";
WQUERY = "QUERY -window";
WW = "WHOWAS";
1 = "WINDOW GOTO 1";
2 = "WINDOW GOTO 2";
3 = "WINDOW GOTO 3";
4 = "WINDOW GOTO 4";
5 = "WINDOW GOTO 5";
6 = "WINDOW GOTO 6";
7 = "WINDOW GOTO 7";
8 = "WINDOW GOTO 8";
9 = "WINDOW GOTO 9";
10 = "WINDOW GOTO 10";
11 = "WINDOW GOTO 11";
12 = "WINDOW GOTO 12";
13 = "WINDOW GOTO 13";
14 = "WINDOW GOTO 14";
15 = "WINDOW GOTO 15";
16 = "WINDOW GOTO 16";
17 = "WINDOW GOTO 17";
18 = "WINDOW GOTO 18";
19 = "WINDOW GOTO 19";
20 = "WINDOW GOTO 20";
21 = "WINDOW GOTO 21";
22 = "WINDOW GOTO 22";
23 = "WINDOW GOTO 23";
24 = "WINDOW GOTO 24";
25 = "WINDOW GOTO 25";
26 = "WINDOW GOTO 26";
27 = "WINDOW GOTO 27";
28 = "WINDOW GOTO 28";
29 = "WINDOW GOTO 29";
30 = "WINDOW GOTO 30";
31 = "WINDOW GOTO 31";
32 = "WINDOW GOTO 32";
33 = "WINDOW GOTO 33";
34 = "WINDOW GOTO 34";
35 = "WINDOW GOTO 35";
36 = "WINDOW GOTO 36";
37 = "WINDOW GOTO 37";
38 = "WINDOW GOTO 38";
39 = "WINDOW GOTO 39";
40 = "WINDOW GOTO 40";
41 = "WINDOW GOTO 41";
42 = "WINDOW GOTO 42";
43 = "WINDOW GOTO 43";
44 = "WINDOW GOTO 44";
45 = "WINDOW GOTO 45";
46 = "WINDOW GOTO 46";
47 = "WINDOW GOTO 47";
48 = "WINDOW GOTO 48";
49 = "WINDOW GOTO 49";
50 = "WINDOW GOTO 50";
51 = "WINDOW GOTO 51";
52 = "WINDOW GOTO 52";
53 = "WINDOW GOTO 53";
54 = "WINDOW GOTO 54";
55 = "WINDOW GOTO 55";
56 = "WINDOW GOTO 56";
57 = "WINDOW GOTO 57";
58 = "WINDOW GOTO 58";
59 = "WINDOW GOTO 59";
60 = "WINDOW GOTO 60";
61 = "WINDOW GOTO 61";
62 = "WINDOW GOTO 62";
63 = "WINDOW GOTO 63";
64 = "WINDOW GOTO 64";
65 = "WINDOW GOTO 65";
66 = "WINDOW GOTO 66";
67 = "WINDOW GOTO 67";
68 = "WINDOW GOTO 68";
69 = "WINDOW GOTO 69";
70 = "WINDOW GOTO 70";
71 = "WINDOW GOTO 71";
72 = "WINDOW GOTO 72";
73 = "WINDOW GOTO 73";
74 = "WINDOW GOTO 74";
75 = "WINDOW GOTO 75";
76 = "WINDOW GOTO 76";
77 = "WINDOW GOTO 77";
78 = "WINDOW GOTO 78";
79 = "WINDOW GOTO 79";
80 = "WINDOW GOTO 80";
81 = "WINDOW GOTO 81";
82 = "WINDOW GOTO 82";
83 = "WINDOW GOTO 83";
84 = "WINDOW GOTO 84";
85 = "WINDOW GOTO 85";
86 = "WINDOW GOTO 86";
87 = "WINDOW GOTO 87";
88 = "WINDOW GOTO 88";
89 = "WINDOW GOTO 89";
90 = "WINDOW GOTO 90";
91 = "WINDOW GOTO 91";
92 = "WINDOW GOTO 92";
93 = "WINDOW GOTO 93";
94 = "WINDOW GOTO 94";
95 = "WINDOW GOTO 95";
96 = "WINDOW GOTO 96";
97 = "WINDOW GOTO 97";
98 = "WINDOW GOTO 98";
99 = "WINDOW GOTO 99";
};
statusbar = {
items = {
barstart = "{sbstart}";
barend = "{sbend}";
topicbarstart = "{topicsbstart}";
topicbarend = "{topicsbend}";
time = "{sb $Z}";
user = "{sb {sbnickmode $cumode}$N{sbmode $usermode}{sbaway $A}}";
window = "{sb $winref:$tag/$itemname{sbmode $M}}";
window_empty = "{sb $winref{sbservertag $tag}}";
prompt = "{prompt $[.15]itemname}";
prompt_empty = "{prompt $winname}";
topic = " $topic";
topic_empty = " Irssi v$J - http://www.irssi.org";
lag = "{sb Lag: $0-}";
act = "{sb Act: $0-}";
more = "-- more --";
};
default = {
window = {
disabled = "no";
type = "window";
placement = "bottom";
position = "1";
visible = "active";
items = {
barstart = { priority = "100"; };
time = { };
user = { };
window = { };
window_empty = { };
lag = { priority = "-1"; };
act = { priority = "10"; };
more = { priority = "-1"; alignment = "right"; };
barend = { priority = "100"; alignment = "right"; };
};
};
window_inact = {
type = "window";
placement = "bottom";
position = "1";
visible = "inactive";
items = {
barstart = { priority = "100"; };
window = { };
window_empty = { };
more = { priority = "-1"; alignment = "right"; };
barend = { priority = "100"; alignment = "right"; };
};
};
prompt = {
type = "root";
placement = "bottom";
position = "100";
visible = "always";
items = {
prompt = { priority = "-1"; };
prompt_empty = { priority = "-1"; };
input = { priority = "10"; };
};
};
topic = {
type = "root";
placement = "top";
position = "1";
visible = "always";
items = {
topicbarstart = { priority = "100"; };
topic = { };
topic_empty = { };
topicbarend = { priority = "100"; alignment = "right"; };
};
};
};
};
settings = {
core = { real_name = "REALNAME"; user_name = "USERNAME"; nick = "USERNAME"; };
"fe-text" = { actlist_sort = "refnum"; };
"fe-common/core" = { theme = "aninix"; };
};
windows = {
1 = {
items = (
{
type = "CHANNEL";
chat_type = "IRC";
name = "CHANNELNAME";
tag = "NETWORKNAME";
}
);
};
};
mainwindows = { 1 = { first_line = "1"; lines = "24"; }; };

View File

@ -1,6 +1,5 @@
LIST=bell bigorlittle compare-directories compress-all diff-args expand-all logged-shell standardize-folder whatismyip new-irssi-config replicate-ssh-profiles worktrack ssh-authorize-host LIST=bell bigorlittle compare-directories compress-all diff-args expand-all logged-shell standardize-folder sysinfo whatismyip worktrack
LOCATION=${pkgbuild}/usr/local/bin LOCATION=${pkgdir}/usr/local/bin
INSTALLER != curl -s https://aninix.net/foundation/installer-test.bash | /bin/bash
PERMISSION=0755 PERMISSION=0755
compile: compile:
@echo Nothing to compile. @echo Nothing to compile.
@ -24,4 +23,3 @@ clean:
diff: diff:
for i in ${LIST}; do diff ./$$i ${LOCATION}/$$i; done for i in ${LIST}; do diff ./$$i ${LOCATION}/$$i; done

View File

@ -1,69 +0,0 @@
#!/bin/bash
function prompt-var() {
if [ -z "$1" ] || [ -z "$2" ]; then
echo "Need a variable name (1) and a prompt string (2)"
return 1;
fi
unset $1
while [ "${!1}" == "" ]; do
printf "%s " "$2";
read $1;
done
return 0;
}
# This function will prompt the user for variable 1 with string 2 until it gets a nonempty answer.
function prompt-password() {
if [ -z "$1" ] || [ -z "$2" ]; then
echo "Need a variable name (1) and a prompt string (2)"
return 1;
fi
unset $1
while [ "${!1}" == "" ]; do
printf "%s " "$2";
read -s $1;
echo
done
return 0;
}
#This function will prompt the user for a variable 1 with string 2 until it gets an answer between min 3 and max 4.
function prompt-num-var() {
if [ -z "$1" ] || [ -z "$2" ] || [ "$3" -ne "$3" ] || [ "$4" -le "$3" ]; then
echo "Need a variable name (1), prompt string (2), min (3), and max (4)";
echo 1: $1;
echo 2: $2;
echo 3: $3;
echo 4: $4;
return 1;
fi
unset $1
while [ "${!1}" == "" ] || [ "${!1}" -lt "$3" ] || [ "${!1}" -gt "$4" ]; do
printf "%s " "$2";
read $1;
done
return 0;
}
# Needed information
prompt-var NETWORKNAME "What is the network name? "
prompt-var IRCADDRESS "What is the IRC address? "
prompt-num-var IRCPORT "What port is listening? " 1 65535
prompt-var CHANNELNAME "What is the first channel to join? "
prompt-var USERNAME "What username do you use on this network? "
prompt-password NICKSERVPASS "What is your password to NickServ?"
prompt-password SERVERPASS "What is the server password? (Enter nopass if no password)"
# Create the config;
cp -r /etc/skel/.irssi ./.irssi-"$NETWORKNAME"
cd ./.irssi-"$NETWORKNAME"
if [ "$SERVERPASS" != "nopass" ]; then
sed -i "s@address = \"IRCADDRESS\";@address = \"IRCADDRESS\";\n password = \"$SERVERPASS\";@" config
fi
sed -i "s@NETWORKNAME@$NETWORKNAME@g" config
sed -i "s@IRCADDRESS@$IRCADDRESS@g" config
sed -i "s@IRCPORT@$IRCPORT@g" config
sed -i "s@CHANNELNAME@$CHANNELNAME@g" config
sed -i "s@USERNAME@$USERNAME@g" config
sed -i "s@REALNAME@$USERNAME@g" config
sed -i "s@NICKSERVPASS@$NICKSERVPASS@g" config
echo
echo "Run \"irssi --home=$PWD\" to start your new config."

View File

@ -1,58 +0,0 @@
#!/bin/bash
# Process CLI arguments to set up assumptions.
searchterm="$1"
if [ -z "$searchterm" ]; then searchterm="'*'"; fi
### <summary>
### Sets up key-based auth to remote hosts and replicate local .bashrc and .profile to them.
### Assumes that
### </summary>
### <param name="searchterm">(Assumed) term to search for as a prefix</param>
### <param name="system">(Assumed) system .ssh/config hostname</param>
### <param name="realname">(Assumed) system real hostname</param>
function push() {
tput setaf 2; tput bold; printf "$system ($realname) ... \n"; tput sgr0;
# Find the Private key to use.
privfile="$(grep IdentityFile $HOME/.ssh/config | grep `echo $system | cut -f 1 -d '-'` | head -n 1 | cut -f 2 -d ' ')"
if [ -z "$privfile" ]; then privfile="$HOME/.ssh/id_rsa"; fi
command='echo mkdir -p "$HOME/.ssh" &> /dev/null; mkdir -p "$HOME/.ssh"; chmod 0700 $HOME $HOME/.ssh; echo "'`cat $privfile.pub`'" >> $HOME/.ssh/authorized_keys; cp $HOME/.ssh/authorized_keys $HOME/.ssh/id_rsa.pub; chmod 0600 $HOME/.ssh/authorized_keys; chown -R `whoami` $HOME 2>/dev/null; mv $HOME/.profile $HOME/.profile.bak 2>/dev/null; mv $HOME/.bashrc $HOME/.bashrc.bak 2>/dev/null; printf "";'
# Make sure that we have the right host signature.
ssh-keygen -R "$realname"
if [ $? -ne 0 ]; then printf "FAILED\n\n"; return; fi
ssh-keyscan -H "$realname" >> ~/.ssh/known_hosts
if [ $? -ne 0 ]; then printf "FAILED\n\n"; return; fi
# Set up home folder and send public key.
ssh -t $system bash -c "$command"
if [ $? -ne 0 ]; then printf "FAILED\n\n"; return; fi
# Self-allow key-based auth
scp $privfile $system:.ssh/id_rsa
if [ $? -ne 0 ]; then printf "FAILED\n\n"; return; fi
# Pass profiles.
scp $HOME/.bashrc $system:.bashrc
if [ $? -ne 0 ]; then printf "FAILED\n\n"; return; fi
scp $HOME/.profile $system:.profile
if [ $? -ne 0 ]; then
printf "FAILED\n\n";
else
printf "DONE\n\n"
fi
}
### <summary>
### If the search term is in ~/.ssh/config, then replicate to all matching hosts.
### Otherwise, replicate to target specifically.
### </summary>
### <param name="searchterm">(Assumed) term to search for as a prefix</param>
if [ `grep -c "$searchterm" "$HOME/.ssh/config"` -gt 0 ]; then
for system in `egrep '^Host ' $HOME/.ssh/config | cut -f 2 -d ' ' | egrep $searchterm`; do
entry=$(cat -n $HOME/.ssh/config | grep $system | head -n 1 | xargs | cut -f 1 -d ' ')
linenum=$(( $entry + 1 ))
realname="$(cat -n $HOME/.ssh/config | grep " ${linenum}$(printf '\t')" | rev | cut -f 1 -d ' ' | rev)"
if [ -z "$realname" ]; then realname="$system"; fi
push;
done
else
system="$searchterm"
push;
fi

View File

@ -1,41 +0,0 @@
#!/bin/bash
#--------------------------------------------------------------------#
#File: ssh-authorize-host
#
#Description: Add a public key to a remote SSH-capable host.
#
#Package: AniNIX::MiscScripts
#Copyright: WTFPL
#
#Author: DarkFeather
#Changelog by editor:
#--------------------------------------------------------------------#
# Show the usage for this script.
function usage {
echo "Usage: $0 host [ pubkeyfile ]"
}
# Create the initial SSH command.
function initialSSHCommand() {
echo 'mkdir -p ${HOME}/.ssh'
echo 'touch ${HOME}/.ssh/authorized_keys'
echo 'chmod 0700 ${HOME} ${HOME}/.ssh'
echo 'chmod 0600 ${HOME}/.ssh/authorized_keys'
echo 'chown -R `whoami`":" ${HOME}'
echo 'cat >> ${HOME}/.ssh/authorized_keys'
}
# Parse the CLI arguments.
host="$1"
if [ -z "$host" ]; then usage; exit 1; fi
pubkeyfile="$2"
if [ -z "$pubkeyfile" ] || [ ! -f "$pubkeyfile" ]; then
pubkeyfile="${HOME}/.ssh/id_rsa.pub"
fi
# Execute on the remote host.
(initialSSHCommand; cat "$pubkeyfile") | ssh "$host" /bin/bash

9
Shared/sysinfo Executable file
View File

@ -0,0 +1,9 @@
#!/bin/bash
(printf "%s | %s | %s %s | %s \n" \
"$(uname -norm)" \
"$(uptime -s)" \
"$(grep -c processor /proc/cpuinfo)" \
"$(grep -m 1 model\ name /proc/cpuinfo | cut -f 2 -d ':')" \
"$(grep MemTotal /proc/meminfo)") \
| sed 's/\s\+/ /g'