From f7cd81f49aa5d7a4581db63bed053e66e692972e Mon Sep 17 00:00:00 2001 From: Ian Kelling Date: Thu, 8 Dec 2016 18:31:20 -0800 Subject: [PATCH] add copyright headers, fix a few things --- btrbk-run | 13 +++++++++++++ check-subvol-stale | 16 ++++++++++++++++ desktop-20-autostart.sh | 13 +++++++++++++ distro-begin | 6 +++--- distro-end | 10 ++++++++++ input-setup | 22 ++++++++++++++++++---- install-btrfs-sync-tools | 14 ++++++++++++++ mail-setup | 2 +- mount-latest-remote | 13 +++++++++++++ mount-latest-subvol | 20 +++++++++++++++++++- myoff | 27 +++++++++++++++++++++++++++ ssh-emacs-setup | 13 +++++++++++++ 12 files changed, 160 insertions(+), 9 deletions(-) create mode 100755 myoff diff --git a/btrbk-run b/btrbk-run index 8cae3a7..c226997 100755 --- a/btrbk-run +++ b/btrbk-run @@ -1,4 +1,17 @@ #!/bin/bash +# Copyright (C) 2016 Ian Kelling + +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at + +# http://www.apache.org/licenses/LICENSE-2.0 + +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. set -eE -o pipefail trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR diff --git a/check-subvol-stale b/check-subvol-stale index 7d36b46..1451844 100644 --- a/check-subvol-stale +++ b/check-subvol-stale @@ -1,4 +1,20 @@ #!/bin/bash +# Copyright (C) 2016 Ian Kelling +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# if latest subvols $@ are not mounted, exit 1, print message, and touch /nocow/btrfs-stale/$subvol [[ $EUID == 0 ]] || exec sudo -E "$BASH_SOURCE" "$@" diff --git a/desktop-20-autostart.sh b/desktop-20-autostart.sh index dd4d9a8..e116960 100755 --- a/desktop-20-autostart.sh +++ b/desktop-20-autostart.sh @@ -1,4 +1,17 @@ #!/bin/bash -l +# Copyright (C) 2016 Ian Kelling + +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at + +# http://www.apache.org/licenses/LICENSE-2.0 + +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. # first 2 alternatives showed under ubuntu 14.04, second 2 under arch at 11/2015 diff --git a/distro-begin b/distro-begin index edb36f4..a765491 100755 --- a/distro-begin +++ b/distro-begin @@ -1,12 +1,12 @@ #!/bin/bash -l # Copyright (C) 2016 Ian Kelling - +# # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at - +# # http://www.apache.org/licenses/LICENSE-2.0 - +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/distro-end b/distro-end index dc97b0d..44be816 100755 --- a/distro-end +++ b/distro-end @@ -59,19 +59,29 @@ case $HOSTNAME in # universal packages # swh-plugins is for karaoke pulsaudio filter. # mutagen for pithos + # lib32stdc++6/default-jdk for android studio + # android site says it needs a bunch of packages for ubuntu, + # but I googled for debian, and someone says you just need one, plus the + # jdk + # https://pid7007blog.blogspot.com/2015/07/installing-android-studio-in-debian-8.html + # see w.org for more android studio details + # simple_packages+=( apache2 bwm-ng chromium + default-jdk duplicity evince fdupes filelight gdb + gitk goaccess gnome-screenshot jq locate + lib32stdc++6 manpages meld nmap diff --git a/input-setup b/input-setup index 66a4b7f..8ad80d3 100755 --- a/input-setup +++ b/input-setup @@ -1,4 +1,18 @@ #!/bin/bash -l +# Copyright (C) 2016 Ian Kelling + +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at + +# http://www.apache.org/licenses/LICENSE-2.0 + +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + #set -x mi() { xinput --get-feedbacks "$1" | grep "threshold" @@ -22,11 +36,11 @@ set_device_id() { } case $HOSTNAME in - tp) - # original saved with: xkbcomp $DISPLAY /a/c/stretch-9-2016.xkb - xkbcomp /a/c/tp.xkb $DISPLAY + tp|x2) + # original saved with: xkbcomp $DISPLAY /a/c/stretch-x2-11-2016.xkb + xkbcomp /a/c/x2.xkb $DISPLAY ;; - treetowl*|iank-dev|frodo|x2) + treetowl*|iank-dev|frodo) # todo, differentiate for work pc #/a/bin/radl if [[ -z $DISPLAY ]]; then diff --git a/install-btrfs-sync-tools b/install-btrfs-sync-tools index da72956..bbf5194 100755 --- a/install-btrfs-sync-tools +++ b/install-btrfs-sync-tools @@ -1,4 +1,18 @@ #!/bin/bash +# Copyright (C) 2016 Ian Kelling + +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at + +# http://www.apache.org/licenses/LICENSE-2.0 + +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + # Running these files directly won't be good since we are # unmounting the volume they live on. diff --git a/mail-setup b/mail-setup index f7dd6b4..db4daa7 100755 --- a/mail-setup +++ b/mail-setup @@ -158,7 +158,7 @@ EOF f=/etc/exim4/passwd.client s touch $f - s chmod 600 $f # make it 600 before writing sensitive info + s chmod 640 $f # before writing sensitive info echo "$domain:${pass/:/::}" | s dd of=$f >/dev/null # https://blog.dhampir.no/content/make-exim4-on-debian-respect-forward-and-etcaliases-when-using-a-smarthost # i only need .forwards, so just doing that one. diff --git a/mount-latest-remote b/mount-latest-remote index b67a460..ec47559 100755 --- a/mount-latest-remote +++ b/mount-latest-remote @@ -1,4 +1,17 @@ #!/bin/bash +# Copyright (C) 2016 Ian Kelling + +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at + +# http://www.apache.org/licenses/LICENSE-2.0 + +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. set -eE -o pipefail trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR diff --git a/mount-latest-subvol b/mount-latest-subvol index 7370931..49ddcd5 100644 --- a/mount-latest-subvol +++ b/mount-latest-subvol @@ -1,4 +1,19 @@ #!/bin/bash +# Copyright (C) 2016 Ian Kelling +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + [[ $EUID == 0 ]] || exec sudo -E "$BASH_SOURCE" "$@" @@ -94,6 +109,7 @@ for vol in q p; do roots=( ${new_roots[@]} ) done + # if latest is already mounted, make sure binds are mounted and move on if e check-subvol-stale $d; then for b in ${binds[@]}; do mnt $b @@ -116,6 +132,7 @@ for vol in q p; do unmounted+=($dir) else umount_ret=false + ret=1 echo "$0: failed to umount $dir" break fi @@ -126,7 +143,6 @@ for vol in q p; do for dir in ${unmounted[@]}; do mnt $dir done - ret=1 continue fi @@ -141,6 +157,8 @@ for vol in q p; do for dir in $d ${binds[@]}; do e mnt $dir done + stale_dir=/nocow/btrfs-stale + rm -f $stale_dir/$d done if [[ $HOSTNAME == treetowl ]]; then diff --git a/myoff b/myoff new file mode 100755 index 0000000..2b48b45 --- /dev/null +++ b/myoff @@ -0,0 +1,27 @@ +#!/bin/bash +# Copyright (C) 2016 Ian Kelling + +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at + +# http://www.apache.org/licenses/LICENSE-2.0 + +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# I failed at figuring out how to make a script happen early in reboot +# but not on shutdown with systemd, so I use this to shutdown +# and ask for a key. + +set -eE -o pipefail +trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR + +if [[ $EUID != 0 ]]; then s=sudo; fi + +$s touch /tmp/keyscript-off +$s poweroff diff --git a/ssh-emacs-setup b/ssh-emacs-setup index d9204a3..ee1dd08 100755 --- a/ssh-emacs-setup +++ b/ssh-emacs-setup @@ -1,4 +1,17 @@ #!/bin/bash -l +# Copyright (C) 2016 Ian Kelling + +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at + +# http://www.apache.org/licenses/LICENSE-2.0 + +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. if [[ $EUID != 0 ]]; then sudo "$0" -- 2.30.2