Partially completed scripts.

This commit is contained in:
Cyteen May 2020-02-16 20:26:53 +00:00
parent a5d8daf790
commit 9ce2fe5701
7 changed files with 350 additions and 0 deletions

View File

@ -11,6 +11,7 @@ apt-get -y install git
apt-get -y install gnutls-bin
apt-get -y install tig
apt-get -y install grc
apt-get -y install gawk
apt-get -y install gitk
apt-get -y install zsync
apt-get -y install jq

View File

@ -181,6 +181,15 @@ EOF
#/usr/bin/bluealsa -S &
#EOF
gawk -i inplace '
/^exit 0/ {
print "export LIBASOUND_THREAD_SAFE=0"
print "/usr/bin/bluealsa -S &"
print ""
}
{ print }
' /etc/rc.local
# Text to speech:
# espeak "Hello, how are you?" -w /home/guido/espeak.wav -s145

172
020_broot.sh Executable file
View File

@ -0,0 +1,172 @@
#!/usr/bin/env bash
set -x
sudo apt-get -y install \
USER="Canop"
PROJECT="broot"
LICENSE="mit"
SECTION="admin"
HOMEPAGE="https://dystroy.org/broot/"
BUILD_HOME="/var/tmp/broot_git_build"
#VERSION="2.1.0"
PACKAGE="broot"
VERSION=$(curl "https://api.github.com/repos/${USER}/${PROJECT}/tags?per_page=5" | jq -r '.[0] | .name')
VERSION=${VERSION:1} # strip the preceding 'v'
DEBEMAIL="person@company.tld"
DEBFULLNAME="Testy McTester"
DESCRIPTION="Integration between BlueZ and ALSA."
LONG_DESCRIPTION=" With BlueALSA one can achieve the same goal as with PulseAudio, but with fewer\n dependencies and less overhead. BlueALSA registers all known Bluetooth audio\n profiles in BlueZ, so in theory every Bluetooth audio device can be connected.\n In order to access the audio stream, one has to connect to the ALSA PCM device\n called bluealsa."
# Disable discoverable timeout in the main.conf from the bluez package
sed -i 's,^\(DiscoverableTimeout = \).*,\1'\"0\"',' /etc/bluetooth/main.conf
# Make the BUILD_HOME directory and clone upstream
mkdir -p ${BUILD_HOME}
cd ${BUILD_HOME} || exit
git clone https://github.com/${USER}/${PROJECT}.git ${PACKAGE}-${VERSION}
cd ${PACKAGE}-${VERSION} || exit
mkdir -p m4
cat <<EOF > .git/gbp.conf
[DEFAULT]
# this is the upstream-branch:
upstream-branch=master
EOF
# debianize the BUILD_HOME directory
echo ${DEBFULLNAME}
dh_make \
--createorig \
--single \
--native \
--copyright ${LICENSE} \
--yes
# Customize the debian directory values
#sed -i 's,^\(Description: \).*,\1'${DESCRIPTION}',' debian/control
sed -i "s,^\(Description: \).*,\1${DESCRIPTION}," debian/control
sed -i 's,^\(Section: \).*,\1'${SECTION}',' debian/control
sed -i "s,^\(Maintainer: \).*,\1'${DEBFULLNAME}\ \<${DEBEMAIL}\>'," debian/control
sed -i 's,^\(Homepage: \).*,\1'${HOMEPAGE}',' debian/control
sed -i "s/.*insert\ long.*/${LONG_DESCRIPTION}/" debian/control
echo ****************
cat debian/control
echo ****************
BUILD_OPTIONS="--enable-aac --enable-ofono --enable-debug"
cat <<EOF > debian/rules
#!/usr/bin/make -f
%:
dh \$@
override_dh_auto_configure:
dh_auto_configure -- ${BUILD_OPTIONS}
EOF
cat <<EOF > debian/watch
version=4
opts=filenamemangle=s/.+\/v?(\d\S+)\.tar\.gz/${PROJECT}-$1\.tar\.gz/ \
https://github.com/${USER}/${PROJECT}/tags .*/v?(\d\S+)\.tar\.gz
EOF
dpkg-buildpackage -us -uc -b
echo ${PACKAGE}_${VERSION}_amd64.deb
sudo dpkg -i ../${PACKAGE}_${VERSION}_amd64.deb
#-------------------------------------------------------------------------------
## When BlueALSA has been created, then you can start BlueALSA as background task:
#bluealsa --disable-hfp &
# Now - for using your bluetooth-speaker/headset - with BlueALSA you have to intoduce the device to the bluetooth-stack using bluetoothctl:
# bluetoothctl >
# scan on
# [NEW] Device 30:23:23:F4:48:2C TH-S10U
# scan off
# pair 30:23:23:F4:48:2C
# trust 30:23:23:F4:48:2C
# exit
# After that power off&on the bt-speaker device and the device will connect automatically as a trusted device.
# Before we try our first audio-command we had to export one thing to make BlueALSA mor system-friendly:
export LIBASOUND_THREAD_SAFE=0
# autostart bluealsa
#cat <<EOF > /etc/rc.local
## Start bluealsa as root <https://github.com/Arkq/bluez-alsa>
#export LIBASOUND_THREAD_SAFE=0
#/usr/bin/bluealsa -S &
#EOF
# Text to speech:
# espeak "Hello, how are you?" -w /home/guido/espeak.wav -s145
# aplay -D bluealsa:HCI=hci0,DEV=30:23:23:F4:48:2C,PROFILE=a2dp /home/guido/espeak.wav
# arecord -D bluealsa capture.wav
# bluealsa-aplay XX:XX:XX:XX:XX:XX
# $ aplay -D bluealsa:SRV=org.bluealsa,DEV=XX:XX:XX:XX:XX:XX,PROFILE=sco Bourree_in_E_minor.wav
# amixer -D bluealsa sset '<control name>' 70%
# amixer -D bluealsa sset 'Jabra MOVE v2.3.0 - A2DP' 50%
# Internetradio:
# mpg123 -a bluealsa:HCI=hci0,DEV=30:23:23:F4:48:2C,PROFILE=a2dp -@ /home/guido/ffh80s.pls
# For shorting the command you could create a ~/.asoundrc with the following content:
# defaults.bluealsa.interface "hci0"
# defaults.bluealsa.device "30:23:23:F4:48:2C"
# defaults.bluealsa.profile "a2dp"
# defaults.bluealsa.delay 10000
# Now you can the shorter version of the command:
# mpg123 -a bluealsa -@ /home/guido/ffh80s.pls
# For set the volume of such a device you have to know the "real" name of the device out of the bluetoothctl and the name of the used protocol:
# Device: 30:23:23:F4:48:2C TH-S10U
# Protocol: A2DP
# amixer -D bluealsa sset 'TH-S10U - A2DP ' 70%
#------------------------------------------------------------------------
## ldacBT
##
## AOSP libldac dispatcher
## https://android.googlesource.com/platform/external/libldac
## https://github.com/EHfive/ldacBT
#git clone https://github.com/EHfive/ldacBT.git
#cd ldacBT
#git submodule update --init
#
#mkdir build && cd build
#cmake \
# -DCMAKE_INSTALL_PREFIX=/usr \
# -DINSTALL_LIBDIR=/usr/lib \
# -DLDAC_SOFT_FLOAT=OFF \
# ../
#make DESTDIR=$DEST_DIR install
#------------------------------------------------------------------------
## [open]aptx - reverse-engineered apt-X
## https://github.com/Arkq/openaptx
#------------------------------------------------------------------------

View File

@ -17,6 +17,7 @@ if [ -e /usr/bin/grc ]; then
alias tail="cl tail"
alias ps="cl ps"
alias lsof="cl lsof"
alias lsof="cl lsd"
alias lsmod="cl lsmod"
alias lsattr="cl lsattr"
alias gcc="cl gcc"

144
020_rustup_checkinstall.sh Normal file
View File

@ -0,0 +1,144 @@
#!/usr/bin/env bash
cd /var/tmp
USER=rust-lang
PROJECT=rustup
PRERELEASE=false
RELEASE=$(curl "https://api.github.com/repos/${USER}/${PROJECT}/tags?per_page=5" | jq -r '.[0] | .name')
# VERSION=$(echo "${RELEASE}" | cut -c 2- | cut -f1 -d"-")
VERSION=$( date +%Y-%m-%d_ )git
DOWNLOAD_DIR=/tmp
# make a containing directory
mkdir -p /var/tmp/rustup-"${RELEASE}"
cd /var/tmp/rustup-"${RELEASE}" || exit
cat > ./description-pak << EOF
The Rustup tool installs and manages the Rust development environment.
EOF
cat > ./checkinstall_it.sh << 'EOF'
echo "ENTERING CHECKINSTALL"
BASE_URL='https://api.github.com/repos'
BASE_USER='rust-lang'
BASE_REPO='rustup'
LICENSE_PAGE_URL="${BASE_URL}/${BASE_USER}/${BASE_REPO}"/license
RELEASES_URL="${BASE_URL}/${BASE_USER}/${BASE_REPO}"/releases
# CONTENT=$(curl -s ${RELEASES_URL}/latest)
# LATEST_URL=$(echo "${CONTENT}" | jq --raw-output '.assets[] | select(.browser_download_url | test("Linux-x86_64")) | .browser_download_url')
echo "LATEST_URL: " "${LATEST_URL}"
# RELEASE=$(echo "${CONTENT}" | jq --raw-output '.tag_name')
# LICENSE_URL=$(curl "${LICENSE_PAGE_URL}" | jq --raw-output '.download_url')
# wget -c ${LICENSE_URL}
VERSION=$( date +%Y-%m-%d_ )git
#VERSION="1.0"
RELEASE="git"
REQUIRES=""
# make a new temporary directory for this use
BASE_TMP_DIR=~/tmptmp/checkinstall_tmp
mkdir -p ${BASE_TMP_DIR}
# do your work
checkinstall -y --fstrans \
--pkgname=rustup \
--pkgversion=${VERSION}\
--pkgrelease=${RELEASE} \
--pkgarch=amd64 \
--pkggroup=admin \
--pkglicense=LICENSE \
--pkgsource=${LATEST_URL} \
--maintainer=cyteen@ring-zero.co.uk \
--requires=${REQUIRES} \
-D \
bash ./install.sh
EOF
cat > ./install.sh << 'EOF'
# https://hoverbear.org/blog/setting-up-a-rust-devenv/
export CARGO_HOME=/home/default.cargo/bin
export RUSTUP_HOME=/home/default/.rustup
# RUSTUP_HOME (default: ~/.rustup or %USERPROFILE%/.rustup) Sets the root rustup folder, used for storing installed toolchains and configuration options.
RUSTUP_HOME
# RUSTUP_TOOLCHAIN (default: none) If set, will override the toolchain used for all rust tool invocations. A toolchain with this name should be installed, or invocations will fail.
RUSTUP_TOOLCHAIN
# RUSTUP_DIST_SERVER (default: https://static.rust-lang.org) Sets the root URL for downloading static resources related to Rust. You can change this to instead use a local mirror, or to test the binaries from the staging directory.
RUSTUP_DIST_SERVER
# RUSTUP_DIST_ROOT (default: https://static.rust-lang.org/dist) Deprecated. Use RUSTUP_DIST_SERVER instead.
RUSTUP_DIST_ROOT
# RUSTUP_UPDATE_ROOT (default https://static.rust-lang.org/rustup) Sets the root URL for downloading self-updates.
RUSTUP_UPDATE_ROOT
# RUSTUP_IO_THREADS unstable (defaults to reported cpu count). Sets the number of threads to perform close IO in. Set to disabled to force single-threaded IO for troubleshooting, or an arbitrary number to override automatic detection.
RUSTUP_IO_THREADS
# RUSTUP_TRACE_DIR unstable (default: no tracing) Enables tracing and determines the directory that traces will be written too. Traces are of the form PID.trace. Traces can be read by the Catapult project tracing viewer.
RUSTUP_TRACE_DIR
# RUSTUP_UNPACK_RAM unstable (default 400M, min 100M) Caps the amount of RAM rustup will use for IO tasks while unpacking.
RUSTUP_UNPACK_RAM
# RUSTUP_NO_BACKTRACE Disables backtraces on non-panic errors even when RUST_BACKTRACE is set.
RUSTUP_NO_BACKTRACE
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
## Completions
# Bash
rustup completions bash > ~/.local/share/bash-completion/completions/rustup
# Zsh completions
rustup completions zsh > ~/.zfunc/_rustup
# update the current shell with the changes
source $HOME/.cargo/env
# install the Rust source and documentation locally
rustup component add rust-src
rustup component add rust-docs
# rust-clippy linter
cargo +nightly install clippy
# rustfmt standard automated styling
cargo install rustfmt
# racer code completion utility
cargo install racer
# set path to rust sources in the environment
export RUST_SRC_PATH=${HOME}/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src
# rls is a language server implementation for Rust. It provides things like code completion, goto definitions, rich refactoring
rustup component add rls --toolchain nightly-x86_64-unknown-linux-gnu
rustup component add rust-analysis --toolchain nightly-x86_64-unknown-linux-gnu
rustup component add rust-src --toolchain nightly-x86_64-unknown-linux-gnu
export DYLD_LIBRARY_PATH=${HOME}/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib
export RLS_ROOT=${HOME}/git/rust/rls
EOF
bash ./checkinstall_it.sh

View File

@ -22,3 +22,11 @@ alias wipe='ionice -c3 /usr/bin/wipe -l1 -v -r'
alias less="less -R"
alias youtube-dl='youtube-dl --external-downloader=aria2c'
EOF
ALIAS_FILE=/home/default/.zsh_aliases.d/003_lsd.sh
cat > ${ALIAS_FILE} <<'EOF'
alias lsd="/usr/bin/lsd"
alias 'ls'="lsd"
alias 'll'="lsd -a"
alias 'lt'="lsd --tree"
EOF

15
broot-install.txt Normal file
View File

@ -0,0 +1,15 @@
Broot should be launched using a shell function (see https://github.com/Canop/broot for explanations).
The function is either missing, old or badly installed.
Can I install it now? [Y n]
y
Writing br shell function in /home/default/.local/share/broot/launcher/bash/1.
Creating link from /home/default/.config/broot/launcher/bash/br to
/home/default/.local/share/broot/launcher/bash/1.
/home/default/.zshrc successfully patched with 'source /home/default/.config/broot/launcher/bash/br'
you can make the function immediately available with
source /home/default/.zshrc