diff options
author | terminaldweller <thabogre@gmail.com> | 2022-04-26 15:20:33 +0000 |
---|---|---|
committer | terminaldweller <thabogre@gmail.com> | 2022-04-26 15:20:33 +0000 |
commit | f217a14da77b2e73fd170ad99b7e22f6abdaf697 (patch) | |
tree | a1abd3a81949dba3dcae2a4c35dc9919dca69a1a | |
parent | update (diff) | |
download | scripts-f217a14da77b2e73fd170ad99b7e22f6abdaf697.tar.gz scripts-f217a14da77b2e73fd170ad99b7e22f6abdaf697.zip |
update
-rw-r--r-- | .zshrc | 2 | ||||
-rwxr-xr-x | chroot/make_devices.sh | 4 | ||||
-rwxr-xr-x | chroot/ubuntu2204.sh | 1 | ||||
-rwxr-xr-x | tmux/date.sh | 19 | ||||
-rwxr-xr-x | tmux/vcs_info.sh | 12 |
5 files changed, 22 insertions, 16 deletions
@@ -273,7 +273,7 @@ math() { } fd() { - ls -l | find -iname "*$1*" + ls $(find -iname "*$1*") } pss() { diff --git a/chroot/make_devices.sh b/chroot/make_devices.sh index 0dc4da9..8a3c1b6 100755 --- a/chroot/make_devices.sh +++ b/chroot/make_devices.sh @@ -19,7 +19,7 @@ make_devices() { env mknod -m 0666 $1/dev/ptmx c 5 2 chown root:tty $1/dev/ptmx } -make_devices /home/devi/chroots/voidmusl -make_devices /home/devi/chroots/voidglibc +# make_devices /home/devi/chroots/voidmusl +# make_devices /home/devi/chroots/voidglibc make_devices /home/devi/chroots/ubuntu2204 # debootstrap stable /home/devi/chroots/debian11 http://deb.debian.org/debian diff --git a/chroot/ubuntu2204.sh b/chroot/ubuntu2204.sh index 792270b..8721218 100755 --- a/chroot/ubuntu2204.sh +++ b/chroot/ubuntu2204.sh @@ -1,5 +1,6 @@ #!/bin/sh +# sudo debootstrap jammy ./ubuntu2204 http://archive.ubuntu.com/ubuntu jammy CHROOT_DIR=/home/devi/chroots/ubuntu2204 sudo mount -t proc proc $CHROOT_DIR/proc/ sudo mount -t sysfs sys $CHROOT_DIR/sys/ diff --git a/tmux/date.sh b/tmux/date.sh index 42044a4..9406561 100755 --- a/tmux/date.sh +++ b/tmux/date.sh @@ -5,21 +5,26 @@ SEPARATOR_LEFT_BOLD="" SEPARATOR_LEFT_THIN="" RESULT=$(date +"%a %D %H:%M") -PROXY="proxychains4 -f /home/devi/proxies/ca/proxychains.conf" +#PROXY="proxychains4 -f /home/devi/proxies/ca/proxychains.conf" -DAY="#[fg=colour255 bg=colour31]"$(echo $RESULT | gawk '{print $1}') -DATE="#[fg=colour255 bg=colour31]"$(echo $RESULT | gawk '{print $2}') -TIME="#[fg=colour255 bg=colour31]"$(echo $RESULT | gawk '{print $3}') +DAY="#[fg=colour255 bg=colour31]"$(echo "$RESULT" | gawk '{print $1}') +DATE="#[fg=colour255 bg=colour31]"$(echo "$RESULT" | gawk '{print $2}') +TIME="#[fg=colour255 bg=colour31]"$(echo "$RESULT" | gawk '{print $3}') UTC_TIME_RESULT=$(date -u +"%H:%M") -UTC_TIME="#[fg=colour255 bg=colour25]"$(echo $UTC_TIME_RESULT) +UTC_TIME="#[fg=colour255 bg=colour25]"$UTC_TIME_RESULT JDATE="#[fg=colour255 bg=colour29]"$(jdate | gawk '{print $2" "$3}') # OPENWEATHERMAP_TOKEN=$(cat /home/devi/scripts/tmux/openweathermap.json|jq -r ".token") # WEATHER_INFO=$(sleep 120 && torsocks curl "https://api.openweathermap.org/data/2.5/weather?q=Tehran&appid=$OPENWEATHERMAP_TOKEN&units=metric"|jq ".main.temp") WEATHER_INFO=$(curl 'wttr.in/tehran?T&format=%f') -WEATHER="#[fg=colour255 bg=colour32]"$(echo $WEATHER_INFO) +echo "$WEATHER_INFO" | grep Unknown\ location; +if [ ! $? ]; then + WEATHER="#[fg=colour255 bg=colour32]"err +else + WEATHER="#[fg=colour255 bg=colour32]"$WEATHER_INFO +fi CPU_TEMP=$(sensors | grep temp1 | head -n 1 | awk '{print $2}') CPU_SECTION="#[fg=colour36 bg=colour16]$SEPARATOR_LEFT_BOLD#[fg=colour16 bg=colour36]$CPU_TEMP" -BATTERY=$(upower -i $(upower -e | grep 'BAT') | grep -E "percentage" | awk '{print $2}') +BATTERY=$(upower -i "$(upower -e | grep 'BAT')" | grep -E "percentage" | awk '{print $2}') echo "$CPU_SECTION#[fg=colour32 bg=colour36]\ $SEPARATOR_LEFT_BOLD$WEATHER#[fg=colour29 bg=colour32]\ diff --git a/tmux/vcs_info.sh b/tmux/vcs_info.sh index 5764e61..f6405a3 100755 --- a/tmux/vcs_info.sh +++ b/tmux/vcs_info.sh @@ -2,23 +2,23 @@ source common.sh SEPARATOR_RIGHT_BOLD="" -SEPARATOR_RIGHT_THIN="" +# SEPARATOR_RIGHT_THIN="" -MIN_MAJOR_VERSION="2" -MIN_MINOR_VERSION="1" -TMUX_VERSION="$(tmux -V)" +# MIN_MAJOR_VERSION="2" +# MIN_MINOR_VERSION="1" +# TMUX_VERSION="$(tmux -V)" get_tmux_cwd() { tmux display -p -F "#{pane_current_path}" } tmux_path=$(get_tmux_cwd) -cd $tmux_path +cd "$tmux_path" IFS='/' read -ra tmux_path_array <<< "$tmux_path" pos=$(( ${#tmux_path_array[*]} - 1 )) last=${tmux_path_array[$pos]} for i in "${tmux_path_array[@]}" do - if [[ $i == $last ]]; then + if [[ $i == "$last" ]]; then shortened_path+=$i else shortened_path+=${i:0:1}/ |