initial funtions
commit
fb4e64f6db
@ -0,0 +1,222 @@
|
||||
function pmm
|
||||
set y 0
|
||||
set u 0
|
||||
set nc 0
|
||||
set ins 0
|
||||
set pkgs
|
||||
for i in $argv
|
||||
if test "$ins" = "1"
|
||||
set pkgs $pkgs $i
|
||||
end
|
||||
if test "$i" = "update"
|
||||
set y 1
|
||||
end
|
||||
if test "$i" = "upgrade"
|
||||
set u 1
|
||||
end
|
||||
if test "$i" = "install"
|
||||
set ins 1
|
||||
end
|
||||
if test "$i" = "--noconfirm"
|
||||
set nc 1
|
||||
end
|
||||
end
|
||||
if test "$y" = "1"
|
||||
for j in (brl list)
|
||||
if strat $j apt --version > /dev/null 2>&1
|
||||
echo "Updating the"(set_color green) "$j"(set_color normal) "stratum."
|
||||
sudo strat $j apt update
|
||||
end
|
||||
end
|
||||
for j in (brl list)
|
||||
if strat $j pacman --version > /dev/null 2>&1
|
||||
echo "Updating the"(set_color green) "$j"(set_color normal) "stratum."
|
||||
sudo strat $j pacman -Sy
|
||||
end
|
||||
end
|
||||
for j in (brl list)
|
||||
if strat $j xbps-install --version > /dev/null 2>&1
|
||||
echo "Updating the"(set_color green) "$j"(set_color normal) "stratum."
|
||||
sudo strat $j xbps-install -S
|
||||
end
|
||||
end
|
||||
for j in (brl list)
|
||||
if strat $j dnf --version > /dev/null 2>&1
|
||||
echo "Updating the"(set_color green) "$j"(set_color normal) "stratum."
|
||||
sudo strat $j dnf check-update
|
||||
end
|
||||
end
|
||||
for j in (brl list)
|
||||
if strat $j emerge --version > /dev/null 2>&1
|
||||
echo "Updating the"(set_color green) "$j"(set_color normal) "stratum."
|
||||
sudo strat $j emerge --sync
|
||||
end
|
||||
end
|
||||
end
|
||||
if test "$u" = "1"
|
||||
for j in (brl list)
|
||||
if strat $j apt --version > /dev/null 2>&1
|
||||
if test "$nc" = "1"
|
||||
set ncarg -y
|
||||
else
|
||||
set ncarg
|
||||
end
|
||||
echo "Upgrading the"(set_color green) "$j"(set_color normal) "stratum."
|
||||
sudo strat -r $j apt upgrade $ncarg
|
||||
end
|
||||
end
|
||||
for j in (brl list)
|
||||
if strat $j pacman --version > /dev/null 2>&1
|
||||
if test "$nc" = "1"
|
||||
set ncarg --noconfirm
|
||||
else
|
||||
set ncarg
|
||||
end
|
||||
echo "Upgrading the"(set_color green) "$j"(set_color normal) "stratum."
|
||||
sudo strat -r $j pacman -Su $ncarg
|
||||
end
|
||||
end
|
||||
for j in (brl list)
|
||||
if strat $j xbps-install --version > /dev/null 2>&1
|
||||
if test "$nc" = "1"
|
||||
set ncarg -y
|
||||
else
|
||||
set ncarg
|
||||
end
|
||||
echo "Upgrading the"(set_color green) "$j"(set_color normal) "stratum."
|
||||
sudo strat -r $j xbps-install -u $ncarg
|
||||
end
|
||||
end
|
||||
for j in (brl list)
|
||||
if strat $j dnf --version > /dev/null 2>&1
|
||||
if test "$nc" = "1"
|
||||
set ncarg -y
|
||||
else
|
||||
set ncarg
|
||||
end
|
||||
echo "Upgrading the"(set_color green) "$j"(set_color normal) "stratum."
|
||||
sudo strat -r $j dnf distro-sync $ncarg
|
||||
end
|
||||
end
|
||||
for j in (brl list)
|
||||
if strat $j emerge --version > /dev/null 2>&1
|
||||
echo "Upgrading the"(set_color green) "$j"(set_color normal) "stratum."
|
||||
sudo strat -r $j emerge -uDU --keep-going --with-bdeps=y @world
|
||||
end
|
||||
end
|
||||
for j in (brl list)
|
||||
if strat $j swupd --version > /dev/null 2>&1
|
||||
echo "Upgrading the"(set_color green) "$j"(set_color normal) "stratum."
|
||||
sudo strat -r $j swupd update
|
||||
end
|
||||
end
|
||||
echo "Upgrading the"(set_color green) "bedrock"(set_color normal) "stratum."
|
||||
sudo brl update
|
||||
end
|
||||
if test "$ins" = "1"
|
||||
for j in (brl list)
|
||||
if strat $j apt --version > /dev/null 2>&1
|
||||
set this 1
|
||||
for k in $pkgs
|
||||
if test -z (apt list "$k" 2>/dev/null | awk -F'/' 'NR>1{print $1}')
|
||||
set this
|
||||
end
|
||||
end
|
||||
if test -n "$this"
|
||||
set stratas $stratas $j
|
||||
end
|
||||
end
|
||||
end
|
||||
for j in (brl list)
|
||||
if strat $j pacman --version > /dev/null 2>&1
|
||||
set this 1
|
||||
for k in $pkgs
|
||||
if test -z (pacman -Ss "$k" | grep "/$k ")
|
||||
set this
|
||||
end
|
||||
end
|
||||
if test -n "$this"
|
||||
set stratas $stratas $j
|
||||
end
|
||||
end
|
||||
end
|
||||
for j in (brl list)
|
||||
if strat $j dnf --version > /dev/null 2>&1
|
||||
set this 1
|
||||
for k in $pkgs
|
||||
if dnf list "$k" > /dev/null 2>&1
|
||||
set this 1
|
||||
else
|
||||
set this
|
||||
end
|
||||
end
|
||||
if test -n "$this"
|
||||
set stratas $stratas $j
|
||||
end
|
||||
end
|
||||
end
|
||||
for j in (brl list)
|
||||
if strat $j xbps-install --version > /dev/null 2>&1
|
||||
set this 1
|
||||
for k in $pkgs
|
||||
if xbps-query -Rs $k | grep "] $k-" > /dev/null 2>&1
|
||||
set this 1
|
||||
else
|
||||
set this
|
||||
end
|
||||
end
|
||||
if test -n "$this"
|
||||
set stratas $stratas $j
|
||||
end
|
||||
end
|
||||
end
|
||||
set chosen (echo $stratas | smenu -T -d -m "Select strata to install from: (Use t to select multiple)" -n 0 | tr " " "\n")
|
||||
for stratum in $chosen
|
||||
if strat $stratum apt --version > /dev/null 2>&1
|
||||
if test "$nc" = "1"
|
||||
set ncarg -y
|
||||
else
|
||||
set ncarg
|
||||
end
|
||||
echo "Installing $pkgs from the"(set_color green) "$stratum"(set_color normal) "stratum."
|
||||
sudo strat -r $stratum apt install $pkgs $ncarg
|
||||
end
|
||||
if strat $stratum pacman --version > /dev/null 2>&1
|
||||
if test "$nc" = "1"
|
||||
set ncarg --noconfirm
|
||||
else
|
||||
set ncarg
|
||||
end
|
||||
echo "Installing $pkgs from the"(set_color green) "$stratum"(set_color normal) "stratum."
|
||||
sudo strat -r $stratum pacman -S $pkgs $ncarg
|
||||
end
|
||||
if strat $stratum xbps-install --version > /dev/null 2>&1
|
||||
if test "$nc" = "1"
|
||||
set ncarg -y
|
||||
else
|
||||
set ncarg
|
||||
end
|
||||
echo "Installing $pkgs from the"(set_color green) "$stratum"(set_color normal) "stratum."
|
||||
sudo strat -r $stratum xbps-install $pkgs $ncarg
|
||||
end
|
||||
if strat $stratum dnf --version > /dev/null 2>&1
|
||||
if test "$nc" = "1"
|
||||
set ncarg -y
|
||||
else
|
||||
set ncarg
|
||||
end
|
||||
echo "Installing $pkgs from the"(set_color green) "$stratum"(set_color normal) "stratum."
|
||||
sudo strat -r $stratum dnf install $pkgs $ncarg
|
||||
end
|
||||
if strat $stratum emerge --version > /dev/null 2>&1
|
||||
if test "$nc" = "1"
|
||||
set ncarg -y
|
||||
else
|
||||
set ncarg
|
||||
end
|
||||
echo "Installing $pkgs from the"(set_color green) "$stratum"(set_color normal) "stratum."
|
||||
sudo strat -r $stratum emerge $pkgs $ncarg
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,14 @@
|
||||
function tp
|
||||
if test $touchpadEnabled = 1
|
||||
set touchpadEnabled 0
|
||||
echo Disabled Trackpad
|
||||
xinput disable "Atmel maXTouch Touchpad"
|
||||
unclutter --timeout 0 &
|
||||
else
|
||||
set touchpadEnabled 1
|
||||
echo Enabled Trackpad
|
||||
xinput enable "Atmel maXTouch Touchpad"
|
||||
kill (jobs -c | grep unclutter) 2>/dev/null
|
||||
end
|
||||
end
|
||||
|
@ -0,0 +1,45 @@
|
||||
function transfer
|
||||
if test (count $argv) -eq 0
|
||||
echo "No arguments specified. Usage:\necho transfer /tmp/test.md\ncat /tmp/test.md | transfer test.md"
|
||||
return 1
|
||||
end
|
||||
|
||||
## get temporarily filename, output is written to this file show progress can be showed
|
||||
set tmpfile ( mktemp -t transferXXX )
|
||||
|
||||
## upload stdin or file
|
||||
set file $argv[1]
|
||||
|
||||
#if tty -s;
|
||||
#then
|
||||
set basefile (basename "$file" | sed -e 's/[^a-zA-Z0-9._-]/-/g')
|
||||
|
||||
# if [ ! -e $file ];
|
||||
# then
|
||||
# echo "File $file doesn't exists."
|
||||
# return 1
|
||||
# fi
|
||||
|
||||
if test -d $file
|
||||
# zip directory and transfer
|
||||
set zipfile ( mktemp -t transferXXX.zip )
|
||||
# echo (dirname $file)
|
||||
#cd (dirname $file) and echo (pwd)
|
||||
zip -r -q - $file >> $zipfile
|
||||
curl --progress-bar --upload-file "$zipfile" "https://transfer.sh/$basefile.zip" >> $tmpfile
|
||||
rm -f $zipfile
|
||||
else
|
||||
# transfer file
|
||||
curl --progress-bar --upload-file "$file" "https://transfer.sh/$basefile" >> $tmpfile
|
||||
end
|
||||
#else
|
||||
# # transfer pipe
|
||||
# curl --progress-bar --upload-file "-" "https://transfer.sh/$file" >> $tmpfile
|
||||
#fi
|
||||
|
||||
## cat output link
|
||||
cat $tmpfile | tr -d '\n'
|
||||
|
||||
## cleanup
|
||||
rm -f $tmpfile
|
||||
end
|
Loading…
Reference in New Issue