Added update-tool
This commit is contained in:
parent
ef9f4be28e
commit
6582eeabc1
62
shells/zshrc
62
shells/zshrc
@ -35,7 +35,17 @@ $ () {
|
|||||||
sv () {
|
sv () {
|
||||||
command="${@: -1}"
|
command="${@: -1}"
|
||||||
while (( $# > 1 )); do
|
while (( $# > 1 )); do
|
||||||
if [[ "$command" == "r" ]]; then
|
if [[ "$command" == "i" ]]; then
|
||||||
|
echo "Status of $1"
|
||||||
|
service "$1" status
|
||||||
|
shift
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
sudo true || return 2
|
||||||
|
if [[ "$1" == "sshd" ]] || [[ "$1" == "ssh" ]]; then
|
||||||
|
echo "Checking sshd config..."
|
||||||
|
sudo sshd -t && echo "Config good. Continuing" || (echo "Aborting due to bad ssh config";return 1)
|
||||||
|
elif [[ "$command" == "r" ]]; then
|
||||||
echo "Restarting $1"
|
echo "Restarting $1"
|
||||||
sudo service "$1" restart
|
sudo service "$1" restart
|
||||||
elif [[ "$command" == "s" ]]; then
|
elif [[ "$command" == "s" ]]; then
|
||||||
@ -44,9 +54,6 @@ sv () {
|
|||||||
elif [[ "$command" == "x" ]]; then
|
elif [[ "$command" == "x" ]]; then
|
||||||
echo "Stopping $1"
|
echo "Stopping $1"
|
||||||
sudo service "$1" stop
|
sudo service "$1" stop
|
||||||
elif [[ "$command" == "i" ]]; then
|
|
||||||
echo "Status of $1"
|
|
||||||
service "$1" status
|
|
||||||
else
|
else
|
||||||
sudo service "$1" "$command"
|
sudo service "$1" "$command"
|
||||||
fi
|
fi
|
||||||
@ -111,12 +118,53 @@ download() {
|
|||||||
URL="$(printf $1 | perl -pe 's/\/paste\/view(?!\/raw)/\/paste\/view\/raw/')"
|
URL="$(printf $1 | perl -pe 's/\/paste\/view(?!\/raw)/\/paste\/view\/raw/')"
|
||||||
curl "$URL" | base64 -d | tar -xf -
|
curl "$URL" | base64 -d | tar -xf -
|
||||||
}
|
}
|
||||||
|
update-tool() {
|
||||||
|
if [ "$EUID" -ne 0 ]; then
|
||||||
|
echo "This function should be run as root"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
local RESP=""
|
||||||
|
while [[ "$RESP" != "q" ]]; do
|
||||||
|
CMD=${RESP:0:1}
|
||||||
|
case "$CMD" in
|
||||||
|
p) update;;
|
||||||
|
l) layman -S ;;
|
||||||
|
u) upgrade;;
|
||||||
|
e) etc-update;;
|
||||||
|
d) emerge -Ava --depclean;;
|
||||||
|
h) haskell-updater -- --usepkg=n;;
|
||||||
|
p) perl-cleaner --reallyall;;
|
||||||
|
y) python-updater;;
|
||||||
|
r) revdep-rebuild;;
|
||||||
|
q) return;;
|
||||||
|
esac
|
||||||
|
RESP=${RESP:1}
|
||||||
|
if [[ ! -z "$RESP" ]]; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
echo "Commands:"
|
||||||
|
echo "p: update"
|
||||||
|
echo "l: layman -S"
|
||||||
|
echo "u: upgrade"
|
||||||
|
echo "e: etc-update"
|
||||||
|
echo "d: emerge --ask --depclean"
|
||||||
|
echo "h: haskell-updater -- --usepkg=n"
|
||||||
|
echo "p: perl-cleaner --reallyall"
|
||||||
|
echo "y: python-updater"
|
||||||
|
echo "r: revdep-rebuild"
|
||||||
|
echo "q: quit"
|
||||||
|
echo -n "> "
|
||||||
|
read RESP
|
||||||
|
done
|
||||||
|
}
|
||||||
|
alias cleaner="sudo ~/run.sh 'perl-cleaner --reallyall' 'python-updater' 'haskell-updater -- --usepkg=n'"
|
||||||
|
alias jsonpretty='python -m json.tool'
|
||||||
alias nmrestart='nmcli radio wifi off;nmcli radio wifi on'
|
alias nmrestart='nmcli radio wifi off;nmcli radio wifi on'
|
||||||
if ex mtr; then
|
if ex mtr; then
|
||||||
alias mtr='mtr -t'
|
alias mtr='mtr -t'
|
||||||
fi
|
fi
|
||||||
if ex telegram-cli; then
|
if ex telegram-cli; then
|
||||||
alias tg='telegram-cli -NWA'
|
alias tg='telegram-cli -NWA --disable-link-preview'
|
||||||
fi
|
fi
|
||||||
alias perm='stat -c "%a %n"'
|
alias perm='stat -c "%a %n"'
|
||||||
alias afci='git x ./autoformat.sh;git commit -am "Autoformatted"'
|
alias afci='git x ./autoformat.sh;git commit -am "Autoformatted"'
|
||||||
@ -171,7 +219,7 @@ if test -f /etc/gentoo-release; then
|
|||||||
upgrade(){
|
upgrade(){
|
||||||
# Sudo echo so we have immediate results on weather sudo worked
|
# Sudo echo so we have immediate results on weather sudo worked
|
||||||
sudo echo "Args: $*"
|
sudo echo "Args: $*"
|
||||||
sudo emerge --update --newuse --deep --verbose --tree --keep-going=y --verbose-conflicts --alert --ask --binpkg-respect-use=y --binpkg-changed-deps=y $* @world
|
sudo emerge --update --newuse --deep --verbose --tree --keep-going=y --verbose-conflicts --alert --ask --binpkg-respect-use=y --binpkg-changed-deps=y --backtrack=30 $* @world
|
||||||
echo "\\a"
|
echo "\\a"
|
||||||
}
|
}
|
||||||
# For emerging with absolute paths
|
# For emerging with absolute paths
|
||||||
@ -197,7 +245,7 @@ if test -f /etc/gentoo-release; then
|
|||||||
echo "You're a server. Exiting"
|
echo "You're a server. Exiting"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
sudo rm '/usr/portage/metadata/timestamp.chk'
|
sudo rm -f '/usr/portage/metadata/timestamp.chk'
|
||||||
if ex eix-update; then
|
if ex eix-update; then
|
||||||
sudo zsh -c "emaint sync -a&&eix-update"
|
sudo zsh -c "emaint sync -a&&eix-update"
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user