2 # Copyright (C) 2016 Ian Kelling
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
8 # http://www.apache.org/licenses/LICENSE-2.0
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
20 exec &> >(sudo
tee -a /var
/log
/distro-end
)
21 echo "$0: $(date): starting now)"
23 src
="${BASH_SOURCE%/*}"
27 IFS
= read -r -d '' y ||
:
31 spa
() { # simple package add
61 # swh-plugins is for karaoke pulsaudio filter.
99 transmission-remote-gtk
107 ########### begin section including li ################
112 if [[ `debian-archive` == testing
]]; then
125 # ubuntu 14.04 uses b-cron,
126 # but its not maintained in arch.
127 # of the ones in the main repos, cronie is only one maintained.
128 # fcron appears abandoned software.
132 *) : ;; # other distros come with cron.
162 arch
) spa the_silver_searcher
;;
163 debian|ubuntu
) spa silversearcher-ag
;;
168 debian|ubuntu
) spa ntp
;;
177 # no equivalent in other distros:
182 # for debconf-get-selections
188 ubuntu|debian
) spa ack-grep
;;
189 arch|fedora
) spa ack
;;
205 case $
(distro-name
) in
207 # allows me to pipe with ssh -t, and gets rid of spam
208 # http://forums.debian.net/viewtopic.php?f=5&t=85822
209 # i'd rather disable the service than comment the init file
210 # this says disabling the service, it will still get restarted
211 # but this script doesn't do anything on restart, so it should be fine
212 s
dd of
=/var
/run
/motd.dynamic
if=/dev
/null
213 # stretch doesn't have initscripts pkg installed by default
214 if [[ $
(debian-codename
) == jessie
]]; then
215 s update-rc.d motd disable
219 # this isn't a complete solution. It still shows me when updates are available,
220 # but it's no big deal.
221 s t
/etc
/update-motd.d
/10-help-text /etc
/update-motd.d
/00-header
227 # https://debian-handbook.info/browse/stable/sect.regular-upgrades.html
228 # /etc/cron.daily/apt calls unattended-upgrades
229 # /usr/share/doc/unattended-upgrades# cat README.md
230 # /etc/apt/apt.conf.d/50unattended-upgrades
232 setup-debian-auto-update
235 # we've got a few dependencies later on, so install them now.
236 pi
"${simple_packages[@]}"
244 lj
) domain
=iank.bid
; exit 0 ;;
245 li
) domain
=iankelling.org
;;
247 /a
/h
/setup.sh
$domain
250 sudo
-E /a
/bin
/mediawiki-setup
/mw-setup-script
253 pi-nostart mumble-server
254 s
sed -ri "s/^ *(serverpassword=).*/\1$(< /a/bin/bash_unpublished/mumble_pass)/" /etc
/mumble-server.ini
259 sudo
dd of
=/etc
/systemd
/system
/vpnmail.service
<<EOF
261 Description=Turns on iptables mail nat
266 ExecStart=/sbin/iptables -t nat -A PREROUTING -i eth0 -p tcp -m tcp --dport 25 -j DNAT --to-destination 10.8.0.4:25
267 ExecStop=/sbin/iptables -t nat -D PREROUTING -i eth0 -p tcp -m tcp --dport 25 -j DNAT --to-destination 10.8.0.4:25
270 WantedBy=openvpn.service
273 ser
enable vpnmail.service
274 acme-tiny-wrapper
mail.iankelling.org
276 tu
/etc
/hosts
<<<"mail.iankelling.org 10.8.0.4"
279 echo "$0: $(date): ending now)"
285 ########### end section including li/lj ###############
287 if private-host; then
288 vpn-mk-client-cert -n mail li
289 echo "ifconfig-push 10.8.0.4 255.255.255.0" | ssh root@li dd of=/etc/openvpn/client-config/$(openssl x509 -noout -subject -in mail.crt | sed -r 's/.*CN *= *([^,]+).*/\1/')
292 if [[ $HOSTNAME == treetowl ]]; then
293 # note, this will need to be changed when the mail host changes
294 sgo openvpn-client@mail
297 ## android studio setup
298 # this contains the setting for android sdk to point to
299 # /a/opt/androidsdk, which is asked upon first run
300 lnf /a/opt/.AndroidStudio2.2 ~
301 # android site says it needs a bunch of packages for ubuntu,
302 # but I googled for debian, and someone says you just need lib32stdc++6 plus the
304 # https://pid7007blog.blogspot.com/2015/07/installing-android-studio-in-debian-8.html
305 # see w.org for more android studio details
306 spa lib32stdc++6 default-jdk
310 arch) pi syncthing ;;
312 # testing has relatively up to date packages
313 if ! isdebian-testing; then
314 # based on error when doing apt-get update:
315 # E: The method driver /usr/lib/apt/methods/https could not be found.
316 pi apt-transport-https
317 # google led me here:
318 # https://apt.syncthing.net/
319 curl -s https://syncthing.net/release-key.txt | sudo apt-key add -
320 s="deb http://apt.syncthing.net/ syncthing release"
321 if [[ $(cat /etc/apt/sources.list.d/syncthing.list) != $s ]]; then
322 echo "$s" | s dd of=/etc/apt/sources.list.d/syncthing.list
329 # installed via f-droid
330 # top right, actions, device id
332 # for installing on a remote comp:
333 # ssh -L 8384:localhost:8384 -N frodo
334 # went to http://localhost:8384/
336 # add folder to sync phone,
337 # staggered file versioning would be my normal choice, but choose
338 # trash can versioning for sake of space on phone, with
339 # clean out after 7 days.
342 # ser start syncthing@ian
343 # then on phone, add device, hit bar code icon,
344 # install bar code scanner.
347 # no equivalent in other distros:
350 # for gui bug reporting
356 ####### misc packages ###########
358 if [[ $HOSTNAME == treetowl ]]; then
361 # note i had to do this, which is persistent:
363 # s chgrp debian-transmission torrents partial-torrents
365 # syslog says things like
366 # 'Failed to set receive buffer: requested 4194304, got 425984'
367 # google suggets giving it even more than that
368 tu /etc/sysctl.conf<<'EOF'
369 net.core.rmem_max = 67108864
370 net.core.wmem_max = 16777216
374 # some reason it doesn't seem to start automatically anyways
375 pi-nostart transmission-daemon
377 # config file documented here, and it's the same config
378 # for daemon vs client, so it's documented in the gui.
379 # https://trac.transmissionbt.com/wiki/EditConfigFiles#Options
381 # I originaly setup rpc-whitelist, but after using
382 # routing to a network namespace, it doesn't see the
383 # real source address, so it's disabled.
385 # Changed the cache-size to 128 mb, reduces disk use.
386 # It is a read & write cache.
388 # todo: setup a password.
391 p = '/etc/transmission-daemon/settings.json'
392 File.write(p, JSON.pretty_generate(JSON.parse(File.read(p)).merge({
393 'rpc-whitelist-enabled' => false,
394 'rpc-authentication-required' => false,
395 'incomplete-dir' => '/k/partial-torrents',
396 'incomplete-dir-enabled' => true,
397 'download-dir' => '/i/k/torrents',
398 "speed-limit-up" => 800,
399 "speed-limit-up-enabled" => true,
400 "peer-port" => 61486,
401 "cache-size-mb" => 128,
402 "ratio-limit" => 1.4000,
403 "ratio-limit-enabled" => false,
404 "pidfile": "/var/lib/transmission-daemon/transmission-daemon.pid",
408 # make sure its not enabled, not sure if this is needed
409 ser disable transmission-daemon
410 sgo transmission-daemon-nn
412 # todo: others unknown
416 # adapted from /var/lib/dpkg/info/transmission-daemon.postinst
417 if ! getent passwd debian-transmission > /dev/null; then
423 --home-dir /var/lib/transmission-daemon \
432 --disabled-password \
433 --home /var/lib/transmission-daemon \
439 # dunno why it's there, but get rid of it
441 li|lj) s rm -rf /home/linode ;;
444 # arch had a default config,
445 # debian had nothing until you start it.
446 # With a little trial an error, here is a minimal config
447 # taken from the generated one, plus changes that the
448 # settings ui does, without a bunch of ui crap settings.
450 # only settings I set were
454 d=$f/.config/transmission-remote-gtk
457 s -u $u dd of=$d/config.json <<'EOF'
461 "profile-name" : "Default",
462 "hostname" : "treetowl",
463 "rpc-url-path" : "/transmission/rpc",
466 "auto-connect" : true,
470 "update-active-only" : false,
471 "activeonly-fullsync-enabled" : false,
472 "activeonly-fullsync-every" : 2,
473 "update-interval" : 3,
474 "min-update-interval" : 3,
475 "session-update-interval" : 60,
483 "add-options-dialog" : false
490 # suggests because we want the resolvconf package.
491 # todo: check other distros to make sure it's installed
492 pi-nostart --install-suggests openvpn
493 # pi-nostart this doesnt seem to be good enough?
494 ser disable openvpn@client
507 wget -nv -N https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
510 s dpkg -i google-chrome-stable_current_amd64.deb |& tee $log
516 # previously I had a more specific search, but dpkg
517 # changed it's output as of 7/2016
518 if grep 'dependency problems' \
519 $log &>/dev/null; then
520 s apt-get -fy install
537 pi cups ghostscript gsfonts # from arch wiki cups page
538 pi hplip # from google
539 s gpasswd -a $USER sys # from arch wiki
540 sgo org.cups.cupsd.service
541 # goto http://127.0.0.1:631
542 # administration tab, add new printer button.
543 # In debian, I could use hte recommended driver,
544 # in arch, I had to pick out the 6L driver.
549 # other distros unknown
554 ubuntu|debian) pi --no-install-recommends mairix notmuch ;;
555 fedora|arch) spa mairix notmuch ;;
558 arch) spa nfs-utils ;;
559 ubuntu|debian) spa nfs-client ;;
562 ubuntu|debian) spa par2 ;;
563 arch|fedora) spa par2cmdline ;;
566 # needed for my tex resume
568 ubuntu|debian) spa texlive-full ;;
569 arch) spa texlive-most ;;
575 # flash, unrar, codecs, ms fonts.
576 # This has a manual prompt.
577 spa ubuntu-restricted-extras
581 # rpm fusion recommended codecs
582 s su -c "yum localinstall -y --nogpgcheck http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm"
583 pi gstreamer-plugins-ugly gstreamer-plugins-bad gstreamer-ffmpeg\
584 xine-lib-extras-freeworld
589 # optional dep for firefox for h.264 video
590 arch) spa gst-libav ;;
591 # other distros, probably come by default
595 fedora|ubuntu|debian) spa gnupg-agent ;;
601 fedora) spa pinentry-gtk ;;
602 *) : ;; # comes default or with other packages
606 arch) spa firefox pulseaudio;;
607 *) : ;; # comes default or with other packages
612 arch) spa ttf-dejavu;;
613 debian|ubuntu) spa fonts-dejavu ;;
620 debian|ubuntu) spa x11-utils ;;
625 arch) pi virt-install;;&
626 debian|ubuntu) pi virtinst ;;&
627 *) pi virt-manager ;; # creates the libvirt group in debian at least
630 # allow user to run vms, from debian handbook
631 for x in ian traci; do s usermod -a -G libvirt,kvm $x; done
632 # bridge networking as user fails. google lead here, but it doesn't work:
633 # oh well, I give up.
634 # http://wiki.qemu.org/Features-Done/HelperNetworking
636 # f=/etc/qemu/bridge.conf
640 # #s chown root:qemu $f # debian has somethig like qemu-libvirt. equivalent?
646 debian|ubuntu) spa genisoimage;;
651 arch) spa spice-gtk3 ;;
652 debian|ubuntu) spa spice-client-gtk;;
656 # general known for debian/ubuntu, not for fedora
659 # cdrkit for cloud-init isos
660 # dnsmasq & ebtables for nat networking in libvirt
661 # qemu for qemu-img, bind-tools for dig
662 # dmidecode just because syslog complains
663 pi unzip xorg-xmodmap dmidecode ebtables\
664 bridge-utils dnsmasq qemu bind-tools
665 # otherwise we get error about accessing kvm module.
666 # seems like there might be a better way, but google was a bit vague.
667 s sed -ri --follow-symlinks '/^ *user *=/d' /etc/libvirt/qemu.conf
668 echo 'user = "root"' | s tee -a /etc/libvirt/qemu.conf
669 # https://bbs.archlinux.org/viewtopic.php?id=206206
670 # # this should prolly go in the wiki
672 # guessing this is not needed
673 #sgo virtlogd.service
680 arch) pi virtviewer ;;
681 *) : ;; # other distros have it as a dependency afaik.
687 fedora) cabal install shellcheck ;;
689 # unknown for older ubuntu
694 arch|debian|ubuntu) spa pumpa ;;
695 # others unknown. do have a buildscript:
696 # /a/bin/buildscripts/pumpa ;;
701 debian|ubuntu) spa android-tools-adbd/unstable ;;
702 arch) spa android-tools ;;
703 # other distros unknown
708 if [[ `debian-archive` == testing ]]; then
709 # has no unstable dependencies
710 spa bitcoin-qt/unstable
712 s cp /a/opt/bitcoin/contrib/init/bitcoind.service /etc/systemd/system
717 s chown -R bitcoin:bitcoin $dir
720 s chown -R root:bitcoin $dir
724 # pruning decreases the bitcoin dir to 2 gb, keeps
725 # just the recent blocks. can't do a few things like
726 # import a wallet dump.
727 # pruning works, but people had to do
728 # some manual stuff in joinmarket. I dun need the
729 # disk space, so not bothering yet, maybe in a year or so.
730 # https://github.com/JoinMarket-Org/joinmarket/issues/431
731 #https://bitcoin.org/en/release/v0.12.0#wallet-pruning
737 rpcpassword=$(openssl rand -base64 32)
738 rpcuser=$(openssl rand -base64 32)
741 walletnotify=curl -sI --connect-timeout 1 http://localhost:62602/walletnotify?%s
742 alertnotify=curl -sI --connect-timeout 1 http://localhost:62602/alertnotify?%s
745 # other distros unknown
747 if [[ $HOSTNAME == treetowl ]]; then
748 pi libsodium-dev python3-pip
750 # using develop branch, as it seems to be mostly bug fixes,
751 # and this is quite new software.
752 # note: python3 does not work.
753 pip install -r requirements.txt
754 # we need bitcoin.conf in the data dir according to
755 # https://github.com/JoinMarket-Org/joinmarket/wiki/Running-JoinMarket-with-Bitcoin-Core-full-node
756 # following the example .service script, I don\'t have it there,
757 # and I generate it, so lets just symlink it.
758 sudo -u bitcoin ln -sf /etc/bitcoin/bitcoin.conf /nocow/.bitcoin
760 # one time, manually did python wallet-tool.py generate.
761 # The "wallet" is just a key which deterministically generates addresses.
762 # One time: move the wallet, then link to it.
763 # ln -s /p/joinmarket/wallet.json wallets
765 # see wallet addresses via:
766 # python wallet-tool.py wallet.json
767 # send to the first 3 mixing depth 0 addresses.
768 # depths are like "identities", to separate out association with
769 # each other. the big hash in that output is the depth/branch id,
772 # after sending btc to wallet from a 3rd party service, check that
773 # at least 20% of utxo of each transaction was sent to you,
774 # btc listtransactions 10 0 true
775 # btc getrawtransaction TXID 1
778 # python wallet-tool.py wallet.json history
780 # to help make other people,
781 # python yield-generator-basic.py wallet.json
783 for var in rpcuser rpcpassword; do
784 u="$(s sed -rn "s/^$var=(.*)/\1/p" /etc/bitcoin/bitcoin.conf)"
786 u="${u//\\/\\\\\\\\}"
789 sed -ri "s,^(rpc_${var#rpc}\s*=).*,\1 $u," joinmarket.cfg
791 sed -ri "s/^\s*(blockchain_source\s*=).*/\1 bitcoin-rpc/" joinmarket.cfg
793 # dunno about sharing a wallet between multiple instances
794 # manually did, wallet.dat symlinked in /nocow/.bitcoin
801 # proprietary flash. going without for now
804 # pi flashplugin-nonfree
812 wget http://tamacom.com/global/global-6.3.2.tar.gz
815 # based on https://github.com/leoliu/ggtags
816 ./configure --with-exuberant-ctags=/usr/bin/ctags
819 s pip install pygments
835 pi task-cinnamon-desktop
836 # in settings, change scrolling to two-finger,
837 # because the default edge scroll doesn\'t work.
846 # already in debian jessie
852 # note this failed running at the beginning of this file,
853 # because no systemd user instance was running.
854 # Doing systemd --user resulted in
855 # Trying to run as user instance, but $XDG_RUNTIME_DIR is not set
857 if isdebian-testing; then
858 # as of 7/2016, has no unstable deps, and is not in testing anymore.
865 # # ubuntu unknown. probably the same as debian, just check if the
866 # # init scripts come with the package.
868 # # copied from arch, but moved to etc
869 # s dd of=/etc/systemd/user/synergys.service <<'EOF'
871 # Description=Synergy Server Daemon
872 # After=network.target
876 # ExecStart=/usr/bin/synergys --no-daemon --config /etc/synergy.conf
880 # WantedBy=multi-user.target
882 # s dd of=/etc/systemd/user/synergys.socket <<'EOF'
884 # Conflicts=synergys@.service
891 # WantedBy=sockets.target
893 # # had this fail with 'Failed to connect to bus: No such file or directory'
894 # # then when I tried it manually, it worked fine...
895 # if ! systemctl --user daemon-reload; then
897 # echo retrying systemd user daemon reload
898 # systemctl --user daemon-reload
902 # # taken from arch wiki.
903 # s dd of=/etc/systemd/system/synergyc@.service <<'EOF'
905 # Description=Synergy Client
906 # After=network.target
910 # ExecStart=/usr/bin/synergyc --no-daemon frodo
912 # # per man systemd.unit, StartLimitInterval, by default we
913 # # restart more than 5 times in 10 seconds.
914 # # And this param defaults too 200 miliseconds.
918 # WantedBy=multi-user.target
920 # s systemctl daemon-reload
923 # ser enable synergyc@ian
924 # ser start synergyc@ian ||: # X might not be running yet
927 # systemctl --user start synergys ||:
928 # systemctl --user enable synergys
935 ######### end misc packages #########
938 # packages I once used before and liked, but don't want installed now for
940 # python-sqlite is used for offlineimap
941 # lxappearance python-sqlite dolphin paman dconf-editor
947 # todo, finish configuring smart.
950 # mostly from https://wiki.archlinux.org/index.php/S.M.A.R.T.
951 # turn on smart. background on options:
952 # first line, -a = test everyting on all devices.
953 # -S on, turn on disk internal saving of vendor specific info,
954 # from google, seems like this is usually already on and fairly standard.
955 # -o on, turn on 4 hour period non-performance degrading testing.
956 # short test daily 2-3am, extended tests Saturdays between 3-4am:
957 sched="-s (S/../.././02|L/../../6/03)"
958 s sed -i --follow-symlinks "s#^[[:space:]]*DEVICESCAN.*#\
959 DEVICESCAN -a -o on -S on -n standby,q $sched \
960 -m ian@iankelling.org -M exec /usr/local/bin/smart-notify#" /etc/smartd.conf
962 # in the default configuration of at least ubuntu 14.04, resolvconf is
963 # configured to order any nameservers associated with tun* or tap*
964 # before the normal internet interfaces, which means they are always
965 # consulted first. This is often slower and undesirable, ie. local dns
966 # queries go from 0ms to 10+ or 100+ ms. To reverse the ordering, you
968 #sudo sed -i --follow-symlinks '/tun\*\|tap\*/d' /etc/resolvconf/interface-order
969 # however, this breaks dns lookup for hosts on the openvpn lan.
970 # I can\'t figure out why hosts on the normal lan would not be
971 # broken under the default ordering, except the host I was
972 # testing with previously had an entry in /etc/hosts.
974 ############# end unfinished
976 ########### misc stuff
979 # the wiki backup script from ofswiki.org uses generic paths
980 s lnf /p/c/machine_specific/li/mw_vars /root
981 s lnf /k/backup/wiki_backup /root
983 s cedit /etc/goaccess.conf <<'EOF' || [[ $? == 1 ]]
984 # all things found from looking around the default config
985 # copied existing NCSA Combined Log Format with Virtual Host, plus %L
986 log-format %^:%^ %h %^[%d:%t %^] "%r" %s %b "%R" "%u" %D
989 log-file /var/log/apache2/access.log
992 # tip: copy access.log files to a stretch host directory, then run
993 # jessie's goaccess is too old for some options, and it's
994 # not easily installed from a testing.
995 # goaccess --ignore-crawlers -f <(cat *) -a -o html > x.html
999 if [[ $HOSTNAME == treetowl ]] && ! sudo test -e /etc/openvpn/client.key; then
1000 /a/bin/vpn-setup/vpn-mk-client-cert dopub
1001 # route lan traffic from inside the network namespace.
1002 tu /etc/openvpn/client.conf "route 192.168.1.0 255.255.255.0 net_gateway"
1008 case `debian-archive` in
1010 s dd of=/etc/apt/preferences.d/unison-gtk <<'EOF'
1011 Explanation: Allow unison-gtk to be upgraded
1013 Pin: release a=unstable
1016 # dont think using testing is needed since I figured out how to
1017 # deal with mismatching unison compilers, but I dont
1018 # see any reason to revert it, since it only installs
1019 # a single package which is primarily a single binary
1023 pi unison-gtk/testing # after to make it the default unison
1032 # default is alsa, doesn\'t work with with pianobar
1033 s dd of=/etc/libao.conf <<'EOF'
1034 default_driver=pulse
1039 # note, for jessie, it depends on a higher version of btrfs-tools.
1041 # # disabled due to my patch being in btrbk
1043 # arch|debian|ubuntu) pi btrbk ;;
1048 spa pv # for progress bar when running interactively.
1049 if [[ $HOSTNAME == treetowl ]]; then
1050 # backup/sync manually on others hosts for now.
1052 # note: to see when it was last run,
1056 if [[ $HOSTNAME == treetowl ]] && [[ `debian-archive` != testing ]]; then
1057 # fail2 ban is broken, with a workaround, per
1058 # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=770171
1059 # ill wait a while to see if it gets fixed
1069 debian|ubuntu) s gpasswd -a ian adm ;; #needed for reading logs
1075 # https://www.torproject.org/docs/rpms.html.en
1076 # https://www.torproject.org/docs/debian.html.en
1077 # todo: figure out if the running service needs to be restarted upon updates
1080 # todo on fedora: setup non-dev packages
1082 s dd of=/etc/yum.repos.d/torproject.repo <<'EOF'
1084 name=Tor experimental repo
1086 baseurl=http://deb.torproject.org/torproject.org/rpm/tor-testing/fc/20/$basearch/
1088 gpgkey=http://deb.torproject.org/torproject.org/rpm/RPM-GPG-KEY-torproject.org.asc
1091 name=Tor experimental source repo
1094 baseurl=http://deb.torproject.org/torproject.org/rpm/tor-testing/fc/20/SRPMS
1096 gpgkey=http://deb.torproject.org/torproject.org/rpm/RPM-GPG-KEY-torproject.org.asc
1099 # to be secure, take a look at the fingerprint reported from the following install, and see if it matches from the link above:
1100 # 3B9E EEB9 7B1E 827B CF0A 0D96 8AF5 653C 5AC0 01F1
1102 /a/bin/buildscripts/tor-browser
1105 tu /etc/apt/sources.list "deb http://deb.torproject.org/torproject.org $(debian-codename) main"
1106 gpg --keyserver keys.gnupg.net --recv 886DDD89
1107 gpg --export A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89 | sudo apt-key add -
1109 pi deb.torproject.org-keyring
1111 /a/bin/buildscripts/tor-browser
1115 /a/bin/buildscripts/tor-browser
1118 pi tor tor-browser-en
1128 fedora todo: disable the firewall or find a way to automate it.
1129 there's an unused section in t.org for tramikssion firewall setup
1131 fedora manual config for nfs:
1133 change to permanent configuration
1134 check the box for nfs
1135 was hard to figure this out, not sure if this is all needed, but
1137 mountd: udp/tcp 20048
1138 portmapper, in firewall-config its called rpc-bind: udp/tcp 111
1139 troubleshooting, unblock things in rpcinfo -p
1140 make sure to reload the firewall to load the persistent configuration
1151 pi nfs-utils || pending_reboot=true
1153 # this failed until I rebooted
1158 if [[ $HOSTNAME == treetowl ]]; then
1159 # nohide = export filesystems mounted deeper than the export point
1160 # fsid=0 makes this export the "root" export
1161 # not documented in the man page, but this means
1162 # 1. it can be mounted with a shorthand of server:/
1163 # 2. exports that are subdirectories of this one will automatically be mounted
1164 tu /etc/exports <<'EOF'
1165 /k 192.168.1.0/24(rw,fsid=0,nohide,no_root_squash,async,no_subtree_check,insecure)
1174 # persistent virtual machines
1182 # distro may not know about win 10 yet.
1184 if ! virt-install --os-variant list &>/dev/null; then # we are using a newer virt-install
1185 for v in 10 8.1 8; do
1186 if osinfo-query os | gr "^\s*win${v/./\\.}\s" &>/dev/null; then
1193 if ! s virsh list --all --name | grep -xF win10 &>/dev/null; then
1195 # created account with
1196 # win10vmian@outlook.com, and easy to remember password
1197 # win 10 virtio, makes disk way way way faster
1198 # wget https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/latest-virtio/virtio-win.iso
1199 # https://wiki.archlinux.org/index.php/QEMU#Change_Existing_Windows_VM_to_use_virtio
1200 # for installing virtio after initial install instead of with initial iso:
1201 # qemu-img create -f qcow2 fake.qcow2 1G
1202 # --disk=/a/images/virtio-win.iso,device=cdrom \
1203 # --disk=/a/images/fake.qcow2,bus=virtio
1205 # went to device manager, saw 2 pci devices with yellow !,
1206 # did search for drivers, pick cdrom location, done.
1208 # from http://www.tenforums.com/tutorials/4189-fast-startup-turn-off-windows-10-a.html.
1209 # google said there was a control panel option for it, but
1210 # that turned out to be a lie.
1211 # Put this in a .bat file and run as administrator to turn off
1212 # hyberboot which fucks things up.
1213 # REG ADD "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Power" /V HiberbootEnabled /T REG_dWORD /D 0 /F
1214 # power settings, turn off display: never
1215 # run "control userpasswords2", turn on automatic login.
1216 # note: when changing devices, I just undefine, the create the vm again.
1218 if [[ -e /a/images/win10.qcow2 ]]; then
1219 s virt-install --noautoconsole --graphics spice,listen=0.0.0.0 \
1220 --disk=/a/images/win10.qcow2,bus=virtio --vcpus 2 -r 4096 -w bridge=br0 \
1221 -n win10 --import --os-variant $variant --cpu host-model-only
1223 s virsh destroy win10
1226 if [[ -e /a/images/win7.qcow2 ]]; then
1227 # this one hasn\'t had the virtio fix done yet.
1228 s virt-install --noautoconsole --graphics spice,listen=0.0.0.0 \
1229 --disk=/a/images/win7.qcow2 --vcpus 2 -r 4096 -w bridge=br0 \
1230 -n win7 --import --os-variant win7 --cpu host-model-only
1231 s virsh destroy win7
1232 # had a problem with --cpu host, so trying out
1233 # --cpu host-model-only
1238 if [[ $HOSTNAME == treetowl ]]; then
1240 # note samba re-reads it\'s config every 1 minute
1242 arch) s cp /etc/samba/smb.conf.default /etc/samba/smb.conf ;;
1245 # add 2 lines after workgroup option
1246 s sed -ri --follow-symlinks '/^\s*encrypt passwords\s*=/d' /etc/samba/smb.conf
1247 s sed -ri --follow-symlinks '/^\s*map to guest\s*=/d' /etc/samba/smb.conf
1248 s sed -i --follow-symlinks 's/\(\s*workgroup\s*=\).*/\1 WORKGROUP\n\tencrypt passwords = yes\n\tmap to guest = bad password/' /etc/samba/smb.conf
1249 # remove default homes section. not sharing that.
1250 s sed -ri --follow-symlinks '/^\s*\[homes\]/,/\s*\[/d' /etc/samba/smb.conf
1252 if ! grep -xF '[public]' /etc/samba/smb.conf &>/dev/null; then
1253 s tee -a /etc/samba/smb.conf <<'EOF'
1263 # systemd claims it generates units from /etc/init.d, but it
1264 # clearly doesn\'t in debian. I have no idea how they are
1265 # related. fuck debian right now. It\'s not documented. samba
1266 # has a systemd init file linked to /dev/null. There\'s this
1267 # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=769714 which
1268 # claims samba\'s sub-services will be started automatically by
1269 # systemd... it didn\'t on install, wonder if it will on
1270 # boot. It clued me in how to start it manually though. Nothing
1271 # in /usr/share/doc/samba, debian admin guide says nothing about
1272 # any of this. (this is in debian testing as of 4/2016).
1274 s /etc/init.d/samba start
1282 tu /etc/hosts <<< "127.0.1.1 $(hostname).lan $(hostname)"
1285 ######### begin stuff belonging at the end ##########
1288 # Apps we want to override others for default file handler:
1289 # simplest way in debian is to just install them last.
1302 pi "${simple_packages[@]}"
1305 if $pending_reboot; then
1306 echo "$0: pending reboot and then finished. doing it now."
1309 echo "$0: $(date): ending now)"