work on install method

main
czoczo 9 months ago
parent 06b5b426c9
commit 1ebb891cb4
  1. 20
      getbb.sh

@ -1,14 +1,22 @@
#!/bin/bash #!/bin/bash
get_file() { get_file() {
echo -e "GET /czoczo/BetterBash/raw/branch/master/$1 HTTP/1.1\r\nHost: git.cz0.cz\r\nConnection: close\r\n\r\n" \ HOST="git.cz0.cz"
| openssl s_client -quiet -connect cz0.cz:443 2>/dev/null \ echo -e "GET /czoczo/BetterBash/raw/branch/master/$1 HTTP/1.1\r\nHost: $HOST\r\nConnection: close\r\n\r\n" \
| openssl s_client -quiet -connect $HOST:443 2>/dev/null \
| sed '1,/^\r$/d' | sed '1,/^\r$/d'
} }
DIR=~/.bb && \ DIR=~/.bb
CMD="[ -f $DIR/bb.sh ] && . $DIR/bb.sh" && \ CMD=$(cat <<-END
# BetterBash
[ -f $DIR/bb.sh ] && . $DIR/bb.sh
END
)
mkdir -p $DIR && \ mkdir -p $DIR && \
get_file /prompt/bb.sh > $DIR/bb.sh && \ get_file /prompt/bb.sh > $DIR/bb.sh && \
get_file /prompt/git-prompt.sh > $DIR/git-prompt.sh && \ get_file /prompt/git-prompt.sh > $DIR/git-prompt.sh && \
get_file /.inputrc >> ~/.inputrc && \ grep -q "BetterBash" ~/.inputrc || get_file /.inputrc >> ~/.inputrc && \
grep -q "$CMD" ~/.bashrc || echo -e "# BetterBash\n$CMD" >> ~/.bashrc bind -f ~/.inputrc && \
grep -q "BetterBash" ~/.bashrc || echo "$CMD" >> ~/.bashrc

Loading…
Cancel
Save