1
This commit is contained in:
commit
6553443d91
22
Makefile
Normal file
22
Makefile
Normal file
@ -0,0 +1,22 @@
|
||||
all:
|
||||
echo OK
|
||||
|
||||
download-blesh:
|
||||
wget "https://github.com/akinomyoga/ble.sh/releases/download/v0.3.4/ble-0.3.4.tar.xz" -O "ble-0.3.4.tar.xz"
|
||||
|
||||
extract-blesh:
|
||||
tar xvf ble-0.3.4.tar.xz
|
||||
|
||||
cleanup:
|
||||
rm -vf ble-0.3.4.tar.xz
|
||||
rm -vfr ./ble-0.3.4
|
||||
|
||||
install-blesh:
|
||||
mkdir -p /usr/local/share/blesh
|
||||
rsync -av ./ble-0.3.4/ /usr/local/share/blesh/
|
||||
chown -R root:root /usr/local/share/blesh/
|
||||
chmod -R o-w /usr/local/share/blesh/
|
||||
bash add-blesh-to-bashrc.sh
|
||||
|
||||
set-shell-to-bash:
|
||||
usermod --shell "/bin/bash" $$(whoami)
|
37
add-blesh-to-bashrc.sh
Executable file
37
add-blesh-to-bashrc.sh
Executable file
@ -0,0 +1,37 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
H=$(head -1 bashrc.head)
|
||||
T=$(head -1 bashrc.tail)
|
||||
|
||||
BASHRC_FILENAME="${HOME}/.bashrc"
|
||||
|
||||
HEAD_EXISTS="0"
|
||||
TAIL_EXISTS="0"
|
||||
|
||||
grep --fixed-strings "${H}" "${BASHRC_FILENAME}"
|
||||
if [ "$?" -eq "0" ]
|
||||
then
|
||||
HEAD_EXISTS="1"
|
||||
fi
|
||||
|
||||
grep --fixed-strings "${T}" "${BASHRC_FILENAME}"
|
||||
if [ "$?" -eq "0" ]
|
||||
then
|
||||
TAIL_EXISTS="1"
|
||||
fi
|
||||
|
||||
|
||||
if [ "${HEAD_EXISTS}" -eq "0" ]
|
||||
then
|
||||
cat bashrc.head "${BASHRC_FILENAME}" > "${BASHRC_FILENAME}.in"
|
||||
cat "${BASHRC_FILENAME}.in" > "${BASHRC_FILENAME}"
|
||||
rm -vf "${BASHRC_FILENAME}.in"
|
||||
fi
|
||||
|
||||
if [ "${TAIL_EXISTS}" -eq "0" ]
|
||||
then
|
||||
cat "${BASHRC_FILENAME}" bashrc.tail > "${BASHRC_FILENAME}.in"
|
||||
cat "${BASHRC_FILENAME}.in" > "${BASHRC_FILENAME}"
|
||||
rm -vf "${BASHRC_FILENAME}.in"
|
||||
fi
|
||||
|
1
bashrc.head
Normal file
1
bashrc.head
Normal file
@ -0,0 +1 @@
|
||||
[[ $- == *i* ]] && source /usr/local/share/blesh/ble.sh --attach=none
|
1
bashrc.tail
Normal file
1
bashrc.tail
Normal file
@ -0,0 +1 @@
|
||||
[[ ${BLE_VERSION-} ]] && ble-attach
|
Loading…
Reference in New Issue
Block a user