From 42be22f792c04177b749918a9c07d221a6b64ae0 Mon Sep 17 00:00:00 2001 From: cyteen Date: Thu, 5 Nov 2020 11:23:08 +0000 Subject: [PATCH] New additions and edits. --- 001_enable-binfmt-misc.sh | 2 + 020_arduino.sh | 20 ++-- 020_cfmesh-cfdof.sh | 176 ++++++++++++++++++++++++++++++++++++ 020_docker-buildx.sh | 128 ++++++++++++++++++++++++++ 020_docker.sh | 6 +- 020_elmerfem.sh | 180 ++++++++++++++++++++++++++++++++++++ 020_freecad.sh | 181 +++++++++++++++++++++++-------------- 020_freerouting.sh | 121 +++++++++++++++++++++++++ 020_how2_checkinstall.sh | 18 ++++ 020_kicad.sh | 8 ++ 020_kvm.sh | 43 +++++++++ 020_nvidia_cuda.sh | 7 +- 020_platformio-core.sh | 4 +- 020_rustup_checkinstall.sh | 4 +- 020_vim.sh | 38 ++++++++ 020_yq.sh | 42 +++++---- octoprint_config-writer.sh | 52 +++++++++++ 17 files changed, 928 insertions(+), 102 deletions(-) create mode 100755 020_cfmesh-cfdof.sh create mode 100644 020_docker-buildx.sh create mode 100755 020_elmerfem.sh create mode 100644 020_freerouting.sh create mode 100644 020_how2_checkinstall.sh create mode 100644 020_kvm.sh create mode 100644 octoprint_config-writer.sh diff --git a/001_enable-binfmt-misc.sh b/001_enable-binfmt-misc.sh index 90ca28f..8103d07 100755 --- a/001_enable-binfmt-misc.sh +++ b/001_enable-binfmt-misc.sh @@ -1,6 +1,7 @@ #!/usr/bin/env bash sudo apt install -y --reinstall qemu qemu-user-static binfmt-support sudo update-binfmts --enable qemu-aarch64 +sudo update-binfmts --enable qemu-arm sudo sed -i '10s/^$/yes/g' /var/lib/binfmts/qemu-arm /var/lib/binfmts/qemu-aarch64 @@ -8,3 +9,4 @@ sudo /etc/init.d/binfmt-support restart # test sudo docker run --rm -it arm64v8/busybox echo Hello World +sudo docker run --rm -it armhf/busybox echo Hello World diff --git a/020_arduino.sh b/020_arduino.sh index 31d5ea0..3c21ce1 100755 --- a/020_arduino.sh +++ b/020_arduino.sh @@ -7,8 +7,8 @@ ARDUINO_DIR=${ARDUINO_HOME}/arduino-${ARDUINO_VERSION}/ ARDUINO_TOOLS_DIR=${ARDUINO_DIR} ADD_URLS= -mkdir "${ARDUINO_TOOLS_DIR}" -sudo apt install -y gcc-arm-none-eabi openocd bsdtar +mkdir -p "${ARDUINO_TOOLS_DIR}" +sudo apt install -y gcc-arm-none-eabi openocd libarchive-tools cd /var/tmp || exit @@ -37,14 +37,14 @@ ${ARDUINO_DIR}/arduino \ # arduino [--install-boards package name:platform architecture[:version]] ${ARDUINO_DIR}/arduino --install-boards esp32:esp32 -# ESP32-core from git 369MB -mkdir -p ${ARDUINO_DIR}/hardware/espressif && \ - cd ${ARDUINO_DIR}/hardware/espressif && \ - git clone https://github.com/espressif/arduino-esp32.git esp32 && \ - cd esp32 && \ - git submodule update --init --recursive && \ - cd tools/ && \ - python3 get.py +## ESP32-core from git 369MB Choose this or the above otherwise you will get two menus +#mkdir -p ${ARDUINO_DIR}/hardware/espressif && \ +# cd ${ARDUINO_DIR}/hardware/espressif && \ +# git clone https://github.com/espressif/arduino-esp32.git esp32 && \ +# cd esp32 && \ +# git submodule update --init --recursive && \ +# cd tools/ && \ +# python3 get.py # Install ESP8266 cd /var/tmp || exit diff --git a/020_cfmesh-cfdof.sh b/020_cfmesh-cfdof.sh new file mode 100755 index 0000000..b619e11 --- /dev/null +++ b/020_cfmesh-cfdof.sh @@ -0,0 +1,176 @@ +#!/usr/bin/env bash +set -x +sudo apt install -y \ + dh-autoreconf \ + dh-make \ + check + + +USER="Arkq" +PROJECT="cfmesh-cfdof" +LICENSE="mit" +SECTION="science" +HOMEPAGE="https://sourceforge.net/projects/cfmesh-cfdof/files/" +BUILD_HOME="/var/tmp/cfmesh-cfdof-git_build" +#VERSION="2.1.0" +PACKAGE="cfmesh-cfdof" +NOW=`date +"%Y-%m-%d"` +#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="Advanced mult-material CFD meshing" +LONG_DESCRIPTION=" A fork of the cfMesh project ported to the latest OpenFOAM versions." + + +# 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} + +git clone https://git.code.sf.net/p/cfmesh-cfdof/cfmesh cfmesh-cfdof-${NOW} + +cd ${PACKAGE}-${NOW} || exit + +mkdir -p m4 + + +cat < .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 < debian/rules +#!/usr/bin/make -f +%: + dh \$@ + +override_dh_auto_configure: + dh_auto_configure -- ${BUILD_OPTIONS} +EOF + +cat < 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 < /etc/rc.local +## Start bluealsa as root +#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 '' 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 + +#------------------------------------------------------------------------ diff --git a/020_docker-buildx.sh b/020_docker-buildx.sh new file mode 100644 index 0000000..2f4c8dd --- /dev/null +++ b/020_docker-buildx.sh @@ -0,0 +1,128 @@ +#!/usr/bin/env bash + +ARCH=$(dpkg --print-architecture) +if [[ ${ARCH} == "armhf" ]]; then ARCH="arm-v7"; fi +USER="docker" +PROJECT="buildx" +LICENSE="apache2" +SECTION="admin" +HOMEPAGE="https://docs.docker.com/buildx/working-with-buildx/" +BUILD_HOME="/var/tmp/buildx_build" +#VERSION="2.1.0" +PACKAGE="docker-buildx" +VERSION=$(curl "https://api.github.com/repos/${USER}/${PROJECT}/tags?per_page=5" | jq '[ .[] | select(.name|test("v[[:digit:].]+$"))]|.[0] | .name') +DEB_VERSION=$(echo ${VERSION} | tr -d "\"" | tr -d "v") # strip the preceding 'v' +#VERSION="1.0.0" +DEBEMAIL="person@company.tld" +DEBFULLNAME="Testy McTester" +DESCRIPTION="." +LONG_DESCRIPTION=" ." + +REQUIRES="docker-ce" +BUILD_DIR="/var/tmp/buildx_build" +WORKDIR="/var/tmp/buildx_build" + +## Checkinstall variables - see defaults in /etc/checkinstallrc +DOC_DIR=/usr/share/doc + +# make a new temporary directory for this use to avoid permission issues. +BASE_TMP_DIR=~/tmptmp/checkinstall_tmp +#------------------------------------------------------------------------------- +mkdir -p ${BUILD_DIR} + +## Create and populate the install scripts and documentation for checkinstall +cat > ${BUILD_DIR}/description-pak << EOF +Docker Buildx is a CLI plugin that extends the docker command with the full support of the features provided by Moby BuildKit builder toolkit. It provides the same user experience as docker build with many new features like creating scoped builder instances and building against multiple nodes concurrently. +EOF + +# | preinstall-pak | Run BEFORE the package is INSTALLED | +cat > ${BUILD_DIR}/preinstall-pak << EOF +#!/usr/bin/env bash +EOF + +# | postinstall-pak | Run AFTER the package is INSTALLED | +cat > ${BUILD_DIR}/postinstall-pak << EOF +#!/usr/bin/env bash +EOF + +# | preremove-pak | Run BEFORE the package is REMOVED | +cat > ${BUILD_DIR}/preremove-pak << EOF +#!/usr/bin/env bash +EOF + +# | postremove-pak | Run AFTER the package is REMOVED +cat > ${BUILD_DIR}/postremove-pak << EOF +#!/usr/bin/env bash +EOF + +## Make the doc-pak directory for README, INSTALL, COPYING, Changelog, TODO, CREDITS +mkdir -p ${BUILD_DIR}/doc-pak +#cp README INSTALL COPYING Changelog TODO CREDITS doc-pak + + +cat > ${BUILD_DIR}/doc-pak/README << 'EOF' +Docker CLI plugin for extended build capabilities with BuildKit + +buildx is Tech Preview +TL;DR + + Familiar UI from docker build + Full BuildKit capabilities with container driver + Multiple builder instance support + Multi-node builds for cross-platform images + Compose build support + WIP: High-level build constructs (bake) + In-container driver support (both Docker and Kubernetes) + +see: https://github.com/docker/buildx +EOF + +cat > ${BUILD_DIR}/checkinstall_it.sh << FOE + +## Checkinstall variables - see defaults in /etc/checkinstallrc +DOC_DIR=/usr/share/doc + +# make a new temporary directory for this use to avoid permission issues. +BASE_TMP_DIR=~/tmptmp/checkinstall_tmp +mkdir -p '${BASE_TMP_DIR}' + + +# do your work +checkinstall -y --fstrans \ + --pkgname=${PACKAGE} \ + --pkgversion=${DEB_VERSION}\ + --pkgrelease=${RELEASE} \ + --pkgarch=${ARCH} \ + --pkggroup=admin \ + --pkglicense=LICENSE \ + --pkgsource=${LATEST_URL} \ + --maintainer=cyteen@ring-zero.co.uk \ + --requires=${REQUIRES} \ + --recommends=${RECOMENDS} \ + --suggests=${SUGGESTS} \ + -D \ + bash ${BUILD_DIR}/install.sh +FOE + +echo "Writing install.sh to: ${BUILD_DIR}/install.sh" +cat > ${BUILD_DIR}/install.sh << FOE +#!/usr/bin/env bash +set -e +#set -x + +# buildx-${VERSION}.darwin-amd64 +# buildx-${VERSION}.linux-amd64 +# buildx-${VERSION}.linux-arm-v6 +# buildx-${VERSION}.linux-arm-v7 +# buildx-${VERSION}.linux-arm64 +# buildx-${VERSION}.linux-ppc64le +# buildx-${VERSION}.linux-s390x + +DEST_DIR=/root/.docker/cli-plugins +#mkdir -p ${DEST_DIR} +mkdir -p /root/.docker/cli-plugins +#wget -O ${DEST_DIR}/docker-buildx https://github.com/docker/${PROJECT}/releases/download/${VERSION}/buildx-${VERSION}.linux-${ARCH} +wget -O /root/.docker/cli-plugins/docker-buildx https://github.com/docker/${PROJECT}/releases/download/${VERSION}/buildx-${VERSION}.linux-${ARCH} +FOE + +bash ${BUILD_DIR}/checkinstall_it.sh diff --git a/020_docker.sh b/020_docker.sh index 5409f0a..2a05d36 100755 --- a/020_docker.sh +++ b/020_docker.sh @@ -18,12 +18,10 @@ bash -c "apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 7EA0A9C3F273FC # Bypass apt-proxy for brave packages -if [ -d /etc/apt/apt.conf.d/02proxy ]; then - if [ ! -z $(grep ${URL}) ]; then +if [ -f /etc/apt/apt.conf.d/02proxy ]; then + if [ ! -z $(grep ${URL} /etc/apt/apt.conf.d/02proxy) ]; then echo "Acquire::http::Proxy { \"${URL}\" DIRECT; };" >> /etc/apt/apt.conf.d/02proxy fi -else - echo "Acquire::http::Proxy { \"${URL}\" DIRECT; };" >> /etc/apt/apt.conf.d/02proxy fi apt update diff --git a/020_elmerfem.sh b/020_elmerfem.sh new file mode 100755 index 0000000..3606eaf --- /dev/null +++ b/020_elmerfem.sh @@ -0,0 +1,180 @@ +#!/usr/bin/env bash +set -x + +sudo apt install -y \ + devscripts + +USER="ElmerCSC" +PROJECT="elmerfem" +LICENSE="gpl2" +SECTION="science" +PRIORITY="optional" +MAINTAINER="Junani Kataja .git/gbp.conf +[DEFAULT] +# this is the upstream-branch: +upstream-branch=${BRANCH} +EOF + +# debianize the BUILD_HOME directory +echo ${DEBFULLNAME} +dh_make -p ${PACKAGE}-${RELEASE}\ + --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,^\(Priority: \).*,\1'${PRIORITY}',' debian/control +sed -i "s,^\(Maintainer: \).*,\1'${DEBFULLNAME}\ \<${DEBEMAIL}\>'," debian/control +sed -i 's,^\(Homepage: \).*,\1'${HOMEPAGE}',' debian/control +sed -i 's,^\(Architecture: \).*,\1'${ARCHITECTURE}',' debian/control +sed -i 's,^\(Build-Depends: \).*,\1'${BUILD_DEPENDS}',' debian/control +sed -i 's,^\(Depends: \).*,\1'${DEPENDS}',' debian/control +sed -i "s/.*insert\ long.*/${LONG_DESCRIPTION}/" debian/control + + +echo **************** +cat debian/control +echo **************** + +cat < debian/autoreconf + +EOF +cat < debian/autoreconf +eio matc elmerparam hutiter meshgen2d fem front elmergrid post +EOF + +cat < debian/libelmsolver-${RELEASE}.prerm +#!/bin/sh -e + +# Remove alternatives links +if [ "$1" = "remove" ]; then + update-alternatives --remove elmersolver /usr/lib/elmersolver-${RELEASE} +fi + +#DEBHELPER# +EOF + + +cat < debian/libelmsolver-${RELEASE}.postinst +#!/bin/sh -e + +# Make alternatives links +if [ "$1" = "configure" ]; then + update-alternatives --install /usr/lib/elmersolver elmersolver \ + /usr/lib/elmersolver-${RELEASE} 6100 +fi + +#DEBHELPER# +EOF + +cat < debian/buildopts_debian.cmake +SET(WITH_MPI TRUE CACHE BOOL "") +SET(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING "") +SET(WITH_MATC TRUE CACHE BOOL "") +SET(WITH_Mumps TRUE CACHE BOOL "") +SET(WITH_Hypre TRUE CACHE BOOL "") +SET(HYPRE_INCLUDE_DIR "/usr/include/hypre" CACHE PATH "") +SET(HYPREROOT "/usr" CACHE PATH "") +SET(WITH_ElmerIce TRUE CACHE BOOL "") + +SET(ELMER_SOLVER_HOME "/usr/share/elmersolver" CACHE PATH "") + +# ElmerGUI related. +SET(WITH_ELMERGUI FALSE CACHE BOOL "") +SET(WITH_OCC TRUE CACHE BOOL "") +SET(WITH_VTK TRUE CACHE BOOL "") +SET(WITH_PARAVIEW TRUE CACHE BOOL "") +SET(WITH_QWT TRUE CACHE BOOL "") +SET(WITH_LUA TRUE CACHE BOOL "") +EOF + +cat < debian/rules +#!/usr/bin/make -f + +BUILDDIR = build_dir + +# secondly called by launchpad +build: + mkdir $(BUILDDIR); + cd $(BUILDDIR); cmake -C ../debian/buildopts_debian.cmake -DCMAKE_INSTALL_PREFIX=../debian/tmp/usr .. + make -j4 -C $(BUILDDIR) + +# thirdly called by launchpad +binary: binary-indep binary-arch + +binary-indep: + # nothing to be done + +binary-arch: + cd $(BUILDDIR); cmake -P cmake_install.cmake + mkdir debian/tmp/DEBIAN + dpkg-gencontrol -pelmerfem-csc + dpkg --build debian/tmp .. + +# firstly called by launchpad +clean: + rm -f build + rm -rf $(BUILDDIR) + +.PHONY: binary binary-arch binary-indep clean +EOF + +cat < 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 + https://github.com/ElmerCSC/elmerfem/tags + https://github.com/ElmerCSC/elmerfem/archive/scc20.tar.gz +EOF + +sudo mk-build-deps --install debian/control +#sudo dpkg -i ${PACKAGE}-build-deps_${RELEASE}_all.deb + +sudo rm debian/*ex debian/*EX +echo "" + + +sudo dpkg-buildpackage -us -uc -b + +echo ${PACKAGE}_${VERSION}_amd64.deb + +sudo dpkg -i ../${PACKAGE}_${VERSION}_amd64.deb + diff --git a/020_freecad.sh b/020_freecad.sh index 59f495f..c20f134 100755 --- a/020_freecad.sh +++ b/020_freecad.sh @@ -2,15 +2,24 @@ # https://github.com/FreeCAD/FreeCAD/releases/ # debian is still on 0.16 but 0.17 is needed for current workbenches -# If building, use cmake gui for configuring the build. -sudo apt install -y cmake-qt-gui python-numpy python3-numpy z88 # the ppa has calculix-ccx eigen3 freecad-daily (0.18~beta1) opencascade # ppa:freecad-maintainers/freecad-daily # sudo add-apt-repository ppa:freecad-maintainers/freecad-daily # sudo apt update - YOUR_UBUNTU_VERSION_HERE=bionic # 18.04 buster/sid +# groovy focal eoan disco cosmic bionic artful xenial trusty +# daily: * * * * +# stable: * * * * * +# community: * * * * +# elmer: * * * * * * + +# YOUR_UBUNTU_VERSION_HERE=goovy # 20.10 buster/sid +# YOUR_UBUNTU_VERSION_HERE=focal # 20.04 buster/sid + YOUR_UBUNTU_VERSION_HERE=eoan # 19.10 buster/sid +# YOUR_UBUNTU_VERSION_HERE=disco # 19.04 buster/sid +# YOUR_UBUNTU_VERSION_HERE=cosmic # 18.10 buster/sid +# YOUR_UBUNTU_VERSION_HERE=bionic # 18.04 buster/sid # YOUR_UBUNTU_VERSION_HERE=artful # 17.10 stretch/sid # YOUR_UBUNTU_VERSION_HERE=xenial # 16.04 stretch/sid # YOUR_UBUNTU_VERSION_HERE=trusty # 14.04 jessie/sid @@ -22,82 +31,80 @@ EOF sudo ln -sf /etc/apt/sources.list-available/freecad-daily.list /etc/apt/sources.list.d/freecad-daily.list # Launchpad PPA for FreeCAD maintainers +# 1024R/83193AA3B52FF6FCF10A1BBF005EAE8119BB5BCA sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 19BB5BCA - sudo bash -c "cat > /etc/apt/sources.list-available/freecad-stable.list" < /etc/apt/sources.list-available/elmer.list" < /etc/apt/sources.list-available/freecad-community.list" < /etc/apt/sources.list-available/elmer.list" <&1 | tee ./make.log \ +# wmake libso meshLibrary \ +# wmake all executables \ +# wmake all utilities -# Available as addon in freecad interface -# https://github.com/jaheyns/CfdFoam +# Build elmer from git +apt update -o Acquire::CompressionTypes::Order::=gz && apt upgrade -y && apt install -y \ + build-essential \ + cmake \ + git \ + libblas-dev \ + liblapack-dev \ + libmumps-dev \ + libparmetis-dev \ + mpich \ + sudo \ + less -sudo apt install -y python-gmsh gmsh -sudo apt install -y gnuplot paraview openfoam +# Clone the ElmerIce source code and compile Elmer/Ice +RUN git clone git://www.github.com/ElmerCSC/elmerfem -b elmerice elmerice \ + && mkdir elmerice/builddir \ + && cd elmerice/builddir \ + && cmake /home/elmerice \ + -DCMAKE_INSTALL_PREFIX=/usr/local/Elmer-devel \ + -DCMAKE_C_COMPILER=/usr/bin/gcc \ + -DCMAKE_Fortran_COMPILER=/usr/bin/gfortran \ + -DWITH_MPI:BOOL=TRUE -DWITH_Mumps:BOOL=TRUE \ + -DWITH_Hypre:BOOL=FALSE -DWITH_Trilinos:BOOL=FALSE \ + -DWITH_ELMERGUI:BOOL=FALSE -DWITH_ElmerIce:BOOL=TRUE \ + && make \ + && make install \ + && rm -R /home/elmerice diff --git a/020_freerouting.sh b/020_freerouting.sh new file mode 100644 index 0000000..652faf6 --- /dev/null +++ b/020_freerouting.sh @@ -0,0 +1,121 @@ +#!/usr/bin/env bash + +## The safest way to use it is to Export Specctra files, open these in FreeRouting and then import the resulting session file. +## From the README +#Additional steps for users of KiCad: +# 1. Download the latest freerouting-executable.jar file from the Releases +# 2. Start KiCad and open your project in Pcbnew. +# 3. Export the PCB into Specctra DSN (File / Export... / Specctra DSN). +# 4. Start the router by running the freerouting-executable.jar file, push the "Open Your Own Design" button and select the exported .dsn file in the file chooser. +# 5. Do the routing. +# 6. When you're finished, export the results into a Specctra session file (File / Export Specctra Session File). The router will generate a .ses file for you. +# 7. Go back to KiCad's Pcbnew and import the results (File / Import Specctra Session...). + + +set -x +ARCH=amd64 +#ARCH=armhf + +sudo apt install -y \ + dh-make \ + debhelper \ + javahelper \ + gradle-debian-helper \ + javahelper \ + default-jdk + +echo "FIXME: The test suite in the package build is disabled as it currently fails, check that they pass before rebuiding." + +USER="freerouting" +PROJECT="freerouting" +LICENSE="gpl3" +SECTION="development" +HOMEPAGE="https://freerouting.mihosoft.eu/" +BUILD_HOME="/var/tmp/freerouting-git_build" +PACKAGE="yq" +VERSION=$(curl "https://api.github.com/repos/${USER}/${PROJECT}/tags?per_page=5" | jq -r '.[0] | .name') +DEBVERSION=${VERSION:1} # strip the preceding 'v' +DEBEMAIL="person@company.tld" +DEBFULLNAME="Testy McTester" +DESCRIPTION="An advanced PCB autorouter." +LONG_DESCRIPTION=" Freerouting is a free and advanced PCB autorouter. It can compete with expensive autorouters and is compatible with most PCB design programs. It works well with KiCad." + +# Make the BUILD_HOME directory and clone upstream +mkdir -p ${BUILD_HOME} +cd ${BUILD_HOME} || exit + +git clone --branch ${VERSION} https://github.com/${USER}/${PROJECT}.git --depth 1 ${PACKAGE}-${DEBVERSION} + +cd ${PACKAGE}-${DEBVERSION} || exit +git checkout tags/${VERSION} + +mkdir -p m4 + +cat < .git/gbp.conf +[DEFAULT] +# this is the upstream-branch: +upstream-branch=master +EOF + +# debianize the BUILD_HOME directory +echo ${DEBFULLNAME} +USER=root dh_make \ + --createorig \ + --indep \ + --native \ + --email ${DEBEMAIL} \ + --copyright ${LICENSE} \ + --yes + +cp README.rst debian/README +rm debian/README.source + +# 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 + +PLACEHOLDER=" " +sed -i 's|'"${PLACEHOLDER}"'|'"${LONG_DESCRIPTION}"'|g' debian/control + +echo **************** +cat debian/control +echo **************** + +BUILD_OPTIONS="--buildsystem=none" + +cat < debian/rules +#!/usr/bin/make -f + +package=freerouting + +%: + dh $@ + +override_dh_auto_build: + export GRADLE_OPTS="-Dorg.gradle.daemon=false -Xmx512m"; \ + dh_auto_build -- assemble + +#override_dh_install: +# dh_auto_build -- installDist -x test; + +#override_dh_clean: +# dh_auto_build -- clean + +get-orig-source: + uscan --verbose --repack --compression xz --download-current-version --force-download +EOF + +cat < 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}_${DEBVERSION}_${ARCH}.deb + +sudo dpkg -i ../${PACKAGE}_${DEBVERSION}_${ARCH}.deb diff --git a/020_how2_checkinstall.sh b/020_how2_checkinstall.sh new file mode 100644 index 0000000..fcf7bc8 --- /dev/null +++ b/020_how2_checkinstall.sh @@ -0,0 +1,18 @@ + +USER=santinic +PROJECT=how-2 +#RELEASE=$(curl "https://api.github.com/repos/${USER}/${PROJECT}/tags?per_page=5" | jq -r '.[0] | .name') +#VERSION=VERSION=$( date +%Y-%m-%d_ )git +VERSION=1.0 +#DOWNLOAD_DIR=/tmp +DEST=/var/tmp/${NPN_PROGRAM}-${VERSION} +mkdir -p /var/tmp/${DEST} + +cat > description-pak << EOF +stackoverflow from the terminal +EOF + + + +cd ${DEST} +sudo checkinstall --fstrans=no bash -c "npm install -g ${NPM_PROGRAM} && npm install -S ${NPM_PROGRAM2}" diff --git a/020_kicad.sh b/020_kicad.sh index 03d752f..f4749a7 100644 --- a/020_kicad.sh +++ b/020_kicad.sh @@ -1 +1,9 @@ apt-get -y install kicad kicad-libraries kicad-symbols kicad-footprints kicad-templates kicad-demos kicad-packages3d + +# freerouting +cd /var/tmp +#git clone http://github.com/miho/freerouting +git clone https://github.com/freerouting/freerouting + +cd freerouting +bash gradlew assemble diff --git a/020_kvm.sh b/020_kvm.sh new file mode 100644 index 0000000..fdcd7aa --- /dev/null +++ b/020_kvm.sh @@ -0,0 +1,43 @@ +sudo apt install -y \ + qemu-kvm \ + libvirt-clients \ + libvirt-daemon-system \ + bridge-utils \ + virtinst \ + libvirt-daemon \ + virt-manager + +sudo virsh net-list --all + +# Start the net and autostart on reboot +sudo virsh net-start default +sudo virsh net-autostart default + +# Offload the mechanism of virtio-net using vhost_net +sudo modprobe vhost_net +echo "vhost_net" | sudo tee -a /etc/modules + +# Add default user to virt group +sudo adduser default libvirt +sudo adduser default libvirt-qemu + +# reload group membership +newgrp libvirt +newgrp libvirt-qemu + +# Add bridge for kvm +sudo cat > /etc/network/interfaces.d/br0 < EOF +#Configure bridge and give it a static ip +auto br0 +iface br0 inet static + address 192.168.1.94 + netmask 255.255.255.0 + network 192.168.1.1 + broadcast 192.168.1.255 + gateway 192.168.1.1 + bridge_ports eth0 + bridge_stp off + bridge_fd 0 + bridge_maxwait 0 + dns-nameservers 8.8.8.8 +EOF diff --git a/020_nvidia_cuda.sh b/020_nvidia_cuda.sh index a6ff141..0e73174 100755 --- a/020_nvidia_cuda.sh +++ b/020_nvidia_cuda.sh @@ -1,9 +1,9 @@ #!/usr/bin/env bash # http://developer.download.nvidia.com/compute/DevZone/docs/html/C/doc/CUDA_C_Getting_Started_Linux.pdf -https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html#package-manager-metas +# https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html#package-manager-metas -http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1704/x86_64/ +# http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1704/x86_64/ # Meta Package Purpose # cuda Installs all CUDA Toolkit and Driver packages. Handles upgrading to the next version of the cuda package when it's released. @@ -34,6 +34,9 @@ apt install -y \ nvidia-visual-profiler \ nvidia-cuda-dev +# nvidia-legacy-340xx-kernel-dkms +# nvidia-legacy-340xx-driver \ +# xserver-xorg-video-nvidia-legacy-340xx # libnvidia-legacy-304xx-cuda1 - NVIDIA CUDA Driver Library (304xx legacy version) # libnvidia-legacy-304xx-nvcuvid1 - NVIDIA CUDA Video Decoder runtime library (304xx legacy version) # libnvidia-legacy-340xx-cuda1 - NVIDIA CUDA Driver Library (340xx legacy version) diff --git a/020_platformio-core.sh b/020_platformio-core.sh index 08780db..5f4c5f8 100755 --- a/020_platformio-core.sh +++ b/020_platformio-core.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash # http://docs.platformio.org/en/latest/faq.html#faq-install-shell-commands -apt install -f python python-pip checkinstall +sudo apt install -f python3 apython3-git python3-pip checkinstall # sudo python -c "$(curl -fsSL https://raw.githubusercontent.com/platformio/platformio/develop/scripts/get-platformio.py)" @@ -19,7 +19,7 @@ mkdir -p "${PIO_BUILD_HOME}" && cd "${PIO_BUILD_HOME}" || exit echo "PlatformIO Core (CLI tool) for embedded programming." > description-pak mkdir -p doc-pak && wget -c --directory-prefix doc-pak https://raw.githubusercontent.com/platformio/platformio-core/develop/README.rst echo "http://docs.platformio.org/en/latest/userguide/index.html" > doc-pak/README -sudo checkinstall --fstrans=no pip install -U https://github.com/platformio/platformio-core/archive/"${RELEASE}".zip +sudo checkinstall -y --fstrans=no pip install -U https://github.com/platformio/platformio-core/archive/"${RELEASE}".zip # install some platforms platformio platform install espressif8266 diff --git a/020_rustup_checkinstall.sh b/020_rustup_checkinstall.sh index bb04c57..d124bdd 100644 --- a/020_rustup_checkinstall.sh +++ b/020_rustup_checkinstall.sh @@ -11,8 +11,8 @@ 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 +mkdir -p /var/tmp/${PROJECT}-"${RELEASE}" +cd /var/tmp/${PROJECT}-"${RELEASE}" || exit cat > ./description-pak << EOF The Rustup tool installs and manages the Rust development environment. diff --git a/020_vim.sh b/020_vim.sh index cbc9e46..7c5cc58 100755 --- a/020_vim.sh +++ b/020_vim.sh @@ -7,6 +7,12 @@ sed -i -e 's/"syntax on/syntax on/' /etc/vim/vimrc sed -i -e 's/"set background=dark/set background=dark/' /etc/vim/vimrc # Macros + +# Directories for swap, backup and undo +mkdir -p ${HOME}/.vim/swap +mkdir -p ${HOME}/.vim/backup +mkdir -p ${HOME}/.vim/undo + # Format json cat > ${DEST}/.vimrc << 'EOF' @@ -20,6 +26,18 @@ cat > ${DEST}/.vimrc << 'EOF' " enable syntax highlighting syntax enable +" persistant undo file in a single location +set undodir=${HOME}/.vim/undo// " Maintain undo history between sessions +set undofile + +" Put backup files in a single location with timestamped names +"set backupdir=${HOME}/.vim/backup// +"au BufWritePre * let &bex = substitute(expand('%:p:h'), '/', ':', 'g') . strftime(';%FT%T') +set nobackup + +" Put swap files in a single location +set directory=${HOME}/.vim/swap// + " enable mouse set mouse=a @@ -284,6 +302,9 @@ call FlutterMenu() Plugin 'neoclide/coc.nvim' Plugin 'tjdevries/coc-zsh' +" Neomake is a plugin for Vim/Neovim to asynchronously run programs. +Plugin 'neomake/neomake' + " Rust Plugin 'rust-lang/rust.vim' @@ -428,6 +449,23 @@ HOME=${DEST} vim -V -E -s -c "source ${DEST}/.vimrc" -c "PluginInstall" -c "Plug # :qa! #EOF +# Add platformio support to Coc +# :CocConfig +#{ +# "ccls": { +# "enable": false, +# "command": "ccls", +# "filetypes": ["c", "cpp", "objc", "objcpp"], +# "rootPatterns": [".ccls", "compile_commands.json", ".vim/", ".git/", ".hg/"], +# "initializationOptions": { +# "cache": { +# "directory": "/tmp/ccls" +# } +# } +# } +# } +#} + # Install YouCompleteMe support apt install -y build-essential cmake exuberant-ctags apt install -y python-dev python3-dev diff --git a/020_yq.sh b/020_yq.sh index b44b5b8..0410802 100755 --- a/020_yq.sh +++ b/020_yq.sh @@ -1,10 +1,15 @@ #!/usr/bin/env bash set -x +ARCH=amd64 +#ARCH=armhf + sudo apt install -y \ jq \ dh-make \ - python-flake8 \ - python-wheel + python3-flake8 \ + python3-wheel + +echo "FIXME: The test suite in the package build is disabled as it currently fails, check that they pass before rebuiding." USER="kislyuk" PROJECT="yq" @@ -12,24 +17,23 @@ LICENSE="mit" SECTION="admin" HOMEPAGE="https://kislyuk.github.io/yq/" BUILD_HOME="/var/tmp/yq-git_build" -#VERSION="2.10.0" PACKAGE="yq" VERSION=$(curl "https://api.github.com/repos/${USER}/${PROJECT}/tags?per_page=5" | jq -r '.[0] | .name') -VERSION=${VERSION:1} # strip the preceding 'v' +DEBVERSION=${VERSION:1} # strip the preceding 'v' DEBEMAIL="person@company.tld" DEBFULLNAME="Testy McTester" DESCRIPTION="Command-line YAML and XML processor." -LONG_DESCRIPTION="Command-line YAML and XML processor - -jq wrapper for YAML/XML documents." +LONG_DESCRIPTION=" Command-line YAML and XML processor\\n jq wrapper for YAML/XML documents." # 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} +#git clone https://github.com/${USER}/${PROJECT}.git ${PACKAGE}-${VERSION} +git clone --branch ${VERSION} https://github.com/${USER}/${PROJECT}.git --depth 1 ${PACKAGE}-${DEBVERSION} -cd ${PACKAGE}-${VERSION} || exit +cd ${PACKAGE}-${DEBVERSION} || exit +git checkout tags/${VERSION} mkdir -p m4 @@ -42,10 +46,11 @@ EOF # debianize the BUILD_HOME directory echo ${DEBFULLNAME} -dh_make \ +USER=root dh_make \ --createorig \ --single \ --native \ + --email ${DEBEMAIL} \ --copyright ${LICENSE} \ --yes @@ -54,25 +59,31 @@ rm debian/README.source # Customize the debian directory values -#sed -i 's,^\(Description: \).*,\1'${DESCRIPTION}',' debian/control +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 +PLACEHOLDER=" " +sed -i 's|'"${PLACEHOLDER}"'|'"${LONG_DESCRIPTION}"'|g' debian/control echo **************** cat debian/control echo **************** -BUILD_OPTIONS="--enable-aac --enable-ofono --enable-debug" +#BUILD_OPTIONS="--enable-aac --enable-ofono --enable-debug" +BUILD_OPTIONS="--buildsystem=none" cat < debian/rules #!/usr/bin/make -f %: dh \$@ +override_dh_auto_test: + echo "Skipping tests." +# -dh_auto_test + override_dh_auto_configure: dh_auto_configure -- ${BUILD_OPTIONS} EOF @@ -85,7 +96,6 @@ EOF dpkg-buildpackage -us -uc -b -echo ${PACKAGE}_${VERSION}_amd64.deb - -sudo dpkg -i ../${PACKAGE}_${VERSION}_amd64.deb +echo ${PACKAGE}_${DEBVERSION}_${ARCH}.deb +sudo dpkg -i ../${PACKAGE}_${DEBVERSION}_${ARCH}.deb diff --git a/octoprint_config-writer.sh b/octoprint_config-writer.sh new file mode 100644 index 0000000..3eb73f1 --- /dev/null +++ b/octoprint_config-writer.sh @@ -0,0 +1,52 @@ +#!/usr/bin/env bash +set -x + +#serial: +# additionalPorts: +# - /tmp/printer +# baudrate: 250000 +# disconnectOnErrors: false +# port: /tmp/printer + +OCTO_PRINTER="/tmp/printer" +SERIAL_DEVICE=${OCTO_PRINTER} +JSON_FILE="config.json" +YAML_FILE="config.yaml" +#BASEDIR="/opt/octoprint/etc/" +BASEDIR="/tmp/" +WORKDIR="/tmp" + +declare -A OCTO_OPT +OCTO_OPT[1]='.serial.additionalPorts = "/tmp/printer" | .serial.baudrate = 250000 | .serial.disconnectOnErrors = "true" | .serial.port = "/tmp/printer" ' + +#OCTO_OPT[1]=".serial.additionalPorts = "${OCTO_PRINTER}" +#| .serial.baudrate = 250000 +#| .serial.disconnectOnErrors = "false" +#| .serial.port = "${OCTO_PRINTER}" " + + + +if [ ! -f ${WORKDIR}/${JSON_FILE} ] +then + echo "{}" > ${WORKDIR}/${JSON_FILE} +else + echo "${WORKDIR}/${JSON_FILE} exists." +fi + +# Count through the number of array elements, using ${# +# looking for one missing. +for ((i = 1; i < ${#OCTO_OPT[@]}; ++i)); do + if [ -z "${OCTO_OPT[$i]}" ]; then + echo Error: $i missing. + exit 1 + fi +done + +# Work through each array element, using ${!. +# regardless how it's spelled. +for i in "${!OCTO_OPT[@]}"; do + OPTION="${OCTO_OPT[$i]}" + jq "${OPTION}" ${WORKDIR}/${JSON_FILE} > ${WORKDIR}/${JSON_FILE}.new && \ + mv -b ${WORKDIR}/${JSON_FILE}.new ${WORKDIR}/${JSON_FILE} + yq -y . ${WORKDIR}/${JSON_FILE} > ${BASEDIR}/${YAML_FILE} +done