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
62 # 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
257 echo "$0: $(date): ending now)"
263 ########### end section including li/lj ###############
267 ## android studio setup
268 # this contains the setting for android sdk to point to
269 # /a/opt/androidsdk, which is asked upon first run
270 lnf
/a
/opt
/.AndroidStudio2.2 ~
271 # android site says it needs a bunch of packages for ubuntu,
272 # but I googled for debian, and someone says you just need lib32stdc++6 plus the
274 # https://pid7007blog.blogspot.com/2015/07/installing-android-studio-in-debian-8.html
275 # see w.org for more android studio details
276 spa lib32stdc
++6 default-jdk
279 if [[ $HOSTNAME == frodo
]]; then
293 arch
) pi syncthing
;;
295 # testing has relatively up to date packages
296 if ! isdebian-testing
; then
297 # based on error when doing apt-get update:
298 # E: The method driver /usr/lib/apt/methods/https could not be found.
299 pi apt-transport-https
300 # google led me here:
301 # https://apt.syncthing.net/
302 curl
-s https
://syncthing.net
/release-key.txt | sudo apt-key add
-
303 s
="deb http://apt.syncthing.net/ syncthing release"
304 if [[ $
(cat /etc
/apt
/sources.list.d
/syncthing.list
) != $s ]]; then
305 echo "$s" | s
dd of
=/etc
/apt
/sources.list.d
/syncthing.list
312 # installed via f-droid
313 # top right, actions, device id
315 # for installing on a remote comp:
316 # ssh -L 8384:localhost:8384 -N frodo
317 # went to http://localhost:8384/
319 # add folder to sync phone,
320 # staggered file versioning would be my normal choice, but choose
321 # trash can versioning for sake of space on phone, with
322 # clean out after 7 days.
325 # ser start syncthing@ian
326 # then on phone, add device, hit bar code icon,
327 # install bar code scanner.
330 # no equivalent in other distros:
333 # for gui bug reporting
339 ####### misc packages ###########
341 if [[ $HOSTNAME == treetowl
]]; then
344 # note i had to do this, which is persistent:
346 # s chgrp debian-transmission torrents partial-torrents
348 # syslog says things like
349 # 'Failed to set receive buffer: requested 4194304, got 425984'
350 # google suggets giving it even more than that
351 tu
/etc
/sysctl.conf
<<'EOF'
352 net.core.rmem_max = 67108864
353 net.core.wmem_max = 16777216
357 # some reason it doesn't seem to start automatically anyways
358 pi-nostart transmission-daemon
360 # config file documented here, and it's the same config
361 # for daemon vs client, so it's documented in the gui.
362 # https://trac.transmissionbt.com/wiki/EditConfigFiles#Options
364 # I originaly setup rpc-whitelist, but after using
365 # routing to a network namespace, it doesn't see the
366 # real source address, so it's disabled.
368 # Changed the cache-size to 128 mb, reduces disk use.
369 # It is a read & write cache.
371 # todo: setup a password.
374 p = '/etc/transmission-daemon/settings.json'
375 File.write(p, JSON.pretty_generate(JSON.parse(File.read(p)).merge({
376 'rpc-whitelist-enabled' => false,
377 'rpc-authentication-required' => false,
378 'incomplete-dir' => '/k/partial-torrents',
379 'incomplete-dir-enabled' => true,
380 'download-dir' => '/i/k/torrents',
381 "speed-limit-up" => 800,
382 "speed-limit-up-enabled" => true,
383 "peer-port" => 61486,
384 "cache-size-mb" => 128,
385 "ratio-limit" => 1.4000,
386 "ratio-limit-enabled" => false,
387 "pidfile": "/var/lib/transmission-daemon/transmission-daemon.pid",
391 # make sure its not enabled, not sure if this is needed
392 ser disable transmission-daemon
393 sgo transmission-daemon-nn
395 # todo: others unknown
399 # adapted from /var/lib/dpkg/info/transmission-daemon.postinst
400 if ! getent passwd debian-transmission
> /dev
/null
; then
406 --home-dir /var
/lib
/transmission-daemon \
415 --disabled-password \
416 --home /var
/lib
/transmission-daemon \
422 # dunno why it's there, but get rid of it
424 li|lj
) s
rm -rf /home
/linode
;;
427 # arch had a default config,
428 # debian had nothing until you start it.
429 # With a little trial an error, here is a minimal config
430 # taken from the generated one, plus changes that the
431 # settings ui does, without a bunch of ui crap settings.
433 # only settings I set were
437 d
=$f/.config
/transmission-remote-gtk
440 s
-u $u dd of
=$d/config.json
<<'EOF'
444 "profile-name" : "Default",
445 "hostname" : "treetowl",
446 "rpc-url-path" : "/transmission/rpc",
449 "auto-connect" : true,
453 "update-active-only" : false,
454 "activeonly-fullsync-enabled" : false,
455 "activeonly-fullsync-every" : 2,
456 "update-interval" : 3,
457 "min-update-interval" : 3,
458 "session-update-interval" : 60,
466 "add-options-dialog" : false
473 # suggests because we want the resolvconf package.
474 # todo: check other distros to make sure it's installed
475 pi-nostart
--install-suggests openvpn
476 # pi-nostart this doesnt seem to be good enough?
477 ser disable openvpn@client
490 wget
-nv -N https
://dl.google.com
/linux
/direct
/google-chrome-stable_current_amd64.deb
493 s dpkg
-i google-chrome-stable_current_amd64.deb |
& tee $log
499 # previously I had a more specific search, but dpkg
500 # changed it's output as of 7/2016
501 if grep 'dependency problems' \
502 $log &>/dev
/null
; then
503 s apt-get
-fy install
520 pi cups ghostscript gsfonts
# from arch wiki cups page
521 pi hplip
# from google
522 s gpasswd
-a $USER sys
# from arch wiki
523 sgo org.cups.cupsd.service
524 # goto http://127.0.0.1:631
525 # administration tab, add new printer button.
526 # In debian, I could use hte recommended driver,
527 # in arch, I had to pick out the 6L driver.
532 # other distros unknown
537 ubuntu|debian
) pi
--no-install-recommends mairix notmuch
;;
538 fedora|arch
) spa mairix notmuch
;;
541 arch
) spa nfs-utils
;;
542 ubuntu|debian
) spa nfs-client
;;
545 ubuntu|debian
) spa par2
;;
546 arch|fedora
) spa par2cmdline
;;
549 # needed for my tex resume
551 ubuntu|debian
) spa texlive-full
;;
552 arch
) spa texlive-most
;;
558 # flash, unrar, codecs, ms fonts.
559 # This has a manual prompt.
560 spa ubuntu-restricted-extras
564 # rpm fusion recommended codecs
565 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"
566 pi gstreamer-plugins-ugly gstreamer-plugins-bad gstreamer-ffmpeg\
567 xine-lib-extras-freeworld
572 # optional dep for firefox for h.264 video
573 arch
) spa gst-libav
;;
574 # other distros, probably come by default
578 fedora|ubuntu|debian
) spa gnupg-agent
;;
584 fedora
) spa pinentry-gtk
;;
585 *) : ;; # comes default or with other packages
589 arch
) spa firefox pulseaudio
;;
590 *) : ;; # comes default or with other packages
595 arch
) spa ttf-dejavu
;;
596 debian|ubuntu
) spa fonts-dejavu
;;
603 debian|ubuntu
) spa x11-utils
;;
608 arch
) pi virt-install
;;&
609 debian|ubuntu
) pi virtinst
;;&
610 *) pi virt-manager
;; # creates the libvirt group in debian at least
613 # allow user to run vms, from debian handbook
614 for x
in ian traci
; do s usermod
-a -G libvirt
,kvm
$x; done
615 # bridge networking as user fails. google lead here, but it doesn't work:
616 # oh well, I give up.
617 # http://wiki.qemu.org/Features-Done/HelperNetworking
619 # f=/etc/qemu/bridge.conf
623 # #s chown root:qemu $f # debian has somethig like qemu-libvirt. equivalent?
629 debian|ubuntu
) spa genisoimage
;;
634 arch
) spa spice-gtk3
;;
635 debian|ubuntu
) spa spice-client-gtk
;;
639 # general known for debian/ubuntu, not for fedora
642 # cdrkit for cloud-init isos
643 # dnsmasq & ebtables for nat networking in libvirt
644 # qemu for qemu-img, bind-tools for dig
645 # dmidecode just because syslog complains
646 pi
unzip xorg-xmodmap dmidecode ebtables\
647 bridge-utils dnsmasq qemu bind-tools
648 # otherwise we get error about accessing kvm module.
649 # seems like there might be a better way, but google was a bit vague.
650 s
sed -ri --follow-symlinks '/^ *user *=/d' /etc
/libvirt
/qemu.conf
651 echo 'user = "root"' | s
tee -a /etc
/libvirt
/qemu.conf
652 # https://bbs.archlinux.org/viewtopic.php?id=206206
653 # # this should prolly go in the wiki
655 # guessing this is not needed
656 #sgo virtlogd.service
663 arch
) pi virtviewer
;;
664 *) : ;; # other distros have it as a dependency afaik.
670 fedora
) cabal
install shellcheck
;;
672 # unknown for older ubuntu
677 arch|debian|ubuntu
) spa pumpa
;;
678 # others unknown. do have a buildscript:
679 # /a/bin/buildscripts/pumpa ;;
684 debian|ubuntu
) spa android-tools-adb
/unstable
;;
685 arch
) spa android-tools
;;
686 # other distros unknown
691 if [[ `debian-archive` == testing
]]; then
692 # has no unstable dependencies
693 spa bitcoin-qt
/unstable
695 s
cp /a
/opt
/bitcoin
/contrib
/init
/bitcoind.service
/etc
/systemd
/system
700 s chown
-R bitcoin
:bitcoin
$dir
703 s chown
-R root
:bitcoin
$dir
707 # pruning decreases the bitcoin dir to 2 gb, keeps
708 # just the recent blocks. can't do a few things like
709 # import a wallet dump.
710 # pruning works, but people had to do
711 # some manual stuff in joinmarket. I dun need the
712 # disk space, so not bothering yet, maybe in a year or so.
713 # https://github.com/JoinMarket-Org/joinmarket/issues/431
714 #https://bitcoin.org/en/release/v0.12.0#wallet-pruning
720 rpcpassword=$(openssl rand -base64 32)
721 rpcuser=$(openssl rand -base64 32)
724 walletnotify=curl -sI --connect-timeout 1 http://localhost:62602/walletnotify?%s
725 alertnotify=curl -sI --connect-timeout 1 http://localhost:62602/alertnotify?%s
728 # other distros unknown
730 if [[ $HOSTNAME == treetowl
]]; then
731 pi libsodium-dev python3-pip
733 # using develop branch, as it seems to be mostly bug fixes,
734 # and this is quite new software.
735 # note: python3 does not work.
736 pip
install -r requirements.txt
737 # we need bitcoin.conf in the data dir according to
738 # https://github.com/JoinMarket-Org/joinmarket/wiki/Running-JoinMarket-with-Bitcoin-Core-full-node
739 # following the example .service script, I don\'t have it there,
740 # and I generate it, so lets just symlink it.
741 sudo
-u bitcoin
ln -sf /etc
/bitcoin
/bitcoin.conf
/nocow
/.bitcoin
743 # one time, manually did python wallet-tool.py generate.
744 # The "wallet" is just a key which deterministically generates addresses.
745 # One time: move the wallet, then link to it.
746 # ln -s /p/joinmarket/wallet.json wallets
748 # see wallet addresses via:
749 # python wallet-tool.py wallet.json
750 # send to the first 3 mixing depth 0 addresses.
751 # depths are like "identities", to separate out association with
752 # each other. the big hash in that output is the depth/branch id,
755 # after sending btc to wallet from a 3rd party service, check that
756 # at least 20% of utxo of each transaction was sent to you,
757 # btc listtransactions 10 0 true
758 # btc getrawtransaction TXID 1
761 # python wallet-tool.py wallet.json history
763 # to help make other people,
764 # python yield-generator-basic.py wallet.json
766 for var
in rpcuser rpcpassword
; do
767 u
="$(s sed -rn "s
/^
$var=(.
*)/\
1/p
" /etc/bitcoin/bitcoin.conf)"
769 u
="${u//\\/\\\\\\\\}"
772 sed -ri "s,^(rpc_${var#rpc}\s*=).*,\1 $u," joinmarket.cfg
774 sed -ri "s/^\s*(blockchain_source\s*=).*/\1 bitcoin-rpc/" joinmarket.cfg
776 # dunno about sharing a wallet between multiple instances
777 # manually did, wallet.dat symlinked in /nocow/.bitcoin
784 # proprietary flash. going without for now
787 # pi flashplugin-nonfree
795 wget http
://tamacom.com
/global
/global-6.3
.2.
tar.gz
798 # based on https://github.com/leoliu/ggtags
799 .
/configure
--with-exuberant-ctags=/usr
/bin
/ctags
802 s pip
install pygments
818 pi task-cinnamon-desktop
819 # in settings, change scrolling to two-finger,
820 # because the default edge scroll doesn\'t work.
829 # already in debian jessie
835 # note this failed running at the beginning of this file,
836 # because no systemd user instance was running.
837 # Doing systemd --user resulted in
838 # Trying to run as user instance, but $XDG_RUNTIME_DIR is not set
840 if isdebian-testing
; then
841 # as of 7/2016, has no unstable deps, and is not in testing anymore.
848 # # ubuntu unknown. probably the same as debian, just check if the
849 # # init scripts come with the package.
851 # # copied from arch, but moved to etc
852 # s dd of=/etc/systemd/user/synergys.service <<'EOF'
854 # Description=Synergy Server Daemon
855 # After=network.target
859 # ExecStart=/usr/bin/synergys --no-daemon --config /etc/synergy.conf
863 # WantedBy=multi-user.target
865 # s dd of=/etc/systemd/user/synergys.socket <<'EOF'
867 # Conflicts=synergys@.service
874 # WantedBy=sockets.target
876 # # had this fail with 'Failed to connect to bus: No such file or directory'
877 # # then when I tried it manually, it worked fine...
878 # if ! systemctl --user daemon-reload; then
880 # echo retrying systemd user daemon reload
881 # systemctl --user daemon-reload
885 # # taken from arch wiki.
886 # s dd of=/etc/systemd/system/synergyc@.service <<'EOF'
888 # Description=Synergy Client
889 # After=network.target
893 # ExecStart=/usr/bin/synergyc --no-daemon frodo
895 # # per man systemd.unit, StartLimitInterval, by default we
896 # # restart more than 5 times in 10 seconds.
897 # # And this param defaults too 200 miliseconds.
901 # WantedBy=multi-user.target
903 # s systemctl daemon-reload
906 # ser enable synergyc@ian
907 # ser start synergyc@ian ||: # X might not be running yet
910 # systemctl --user start synergys ||:
911 # systemctl --user enable synergys
918 ######### end misc packages #########
921 # packages I once used before and liked, but don't want installed now for
923 # python-sqlite is used for offlineimap
924 # lxappearance python-sqlite dolphin paman dconf-editor
930 # todo, finish configuring smart.
933 # mostly from https://wiki.archlinux.org/index.php/S.M.A.R.T.
934 # turn on smart. background on options:
935 # first line, -a = test everyting on all devices.
936 # -S on, turn on disk internal saving of vendor specific info,
937 # from google, seems like this is usually already on and fairly standard.
938 # -o on, turn on 4 hour period non-performance degrading testing.
939 # short test daily 2-3am, extended tests Saturdays between 3-4am:
940 sched
="-s (S/../.././02|L/../../6/03)"
941 s
sed -i --follow-symlinks "s#^[[:space:]]*DEVICESCAN.*#\
942 DEVICESCAN -a -o on -S on -n standby,q $sched \
943 -m ian@iankelling.org -M exec /usr/local/bin/smart-notify#" /etc
/smartd.conf
945 # in the default configuration of at least ubuntu 14.04, resolvconf is
946 # configured to order any nameservers associated with tun* or tap*
947 # before the normal internet interfaces, which means they are always
948 # consulted first. This is often slower and undesirable, ie. local dns
949 # queries go from 0ms to 10+ or 100+ ms. To reverse the ordering, you
951 #sudo sed -i --follow-symlinks '/tun\*\|tap\*/d' /etc/resolvconf/interface-order
952 # however, this breaks dns lookup for hosts on the openvpn lan.
953 # I can\'t figure out why hosts on the normal lan would not be
954 # broken under the default ordering, except the host I was
955 # testing with previously had an entry in /etc/hosts.
957 ############# end unfinished
959 ########### misc stuff
962 # the wiki backup script from ofswiki.org uses generic paths
963 s lnf
/p
/c
/machine_specific
/li
/mw_vars
/root
964 s lnf
/k
/backup
/wiki_backup
/root
966 s cedit
/etc
/goaccess.conf
<<'EOF' || [[ $? == 1 ]]
967 # all things found from looking around the default config
968 # copied existing NCSA Combined Log Format with Virtual Host, plus %L
969 log-format %^:%^ %h %^[%d:%t %^] "%r" %s %b "%R" "%u" %D
972 log-file /var/log/apache2/access.log
975 # tip: copy access.log files to a stretch host directory, then run
976 # jessie's goaccess is too old for some options, and it's
977 # not easily installed from a testing.
978 # goaccess --ignore-crawlers -f <(cat *) -a -o html > x.html
982 if [[ $HOSTNAME == treetowl
]] && ! sudo
test -e /etc
/openvpn
/client.key
; then
983 /a
/bin
/vpn-setup
/vpn-mk-client-cert dopub
984 # route lan traffic from inside the network namespace.
985 tu
/etc
/openvpn
/client.conf
"route 192.168.1.0 255.255.255.0 net_gateway"
991 case `debian-archive` in
993 s
dd of
=/etc
/apt
/preferences.d
/unison-gtk
<<'EOF'
994 Explanation: Allow unison-gtk to be upgraded
996 Pin: release a=unstable
999 # dont think using testing is needed since I figured out how to
1000 # deal with mismatching unison compilers, but I dont
1001 # see any reason to revert it, since it only installs
1002 # a single package which is primarily a single binary
1006 pi unison-gtk
/testing
# after to make it the default unison
1015 # default is alsa, doesn\'t work with with pianobar
1016 s
dd of
=/etc
/libao.conf
<<'EOF'
1017 default_driver=pulse
1022 # note, for jessie, it depends on a higher version of btrfs-tools.
1024 # # disabled due to my patch being in btrbk
1026 # arch|debian|ubuntu) pi btrbk ;;
1031 spa pv
# for progress bar when running interactively.
1032 if [[ $HOSTNAME == treetowl
]]; then
1033 # backup/sync manually on others hosts for now.
1035 # note: to see when it was last run,
1039 if [[ $HOSTNAME == treetowl
]] && [[ `debian-archive` != testing
]]; then
1040 # fail2 ban is broken, with a workaround, per
1041 # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=770171
1042 # ill wait a while to see if it gets fixed
1052 debian|ubuntu
) s gpasswd
-a ian adm
;; #needed for reading logs
1058 # https://www.torproject.org/docs/rpms.html.en
1059 # https://www.torproject.org/docs/debian.html.en
1060 # todo: figure out if the running service needs to be restarted upon updates
1063 # todo on fedora: setup non-dev packages
1065 s
dd of
=/etc
/yum.repos.d
/torproject.repo
<<'EOF'
1067 name=Tor experimental repo
1069 baseurl=http://deb.torproject.org/torproject.org/rpm/tor-testing/fc/20/$basearch/
1071 gpgkey=http://deb.torproject.org/torproject.org/rpm/RPM-GPG-KEY-torproject.org.asc
1074 name=Tor experimental source repo
1077 baseurl=http://deb.torproject.org/torproject.org/rpm/tor-testing/fc/20/SRPMS
1079 gpgkey=http://deb.torproject.org/torproject.org/rpm/RPM-GPG-KEY-torproject.org.asc
1082 # to be secure, take a look at the fingerprint reported from the following install, and see if it matches from the link above:
1083 # 3B9E EEB9 7B1E 827B CF0A 0D96 8AF5 653C 5AC0 01F1
1085 /a
/bin
/buildscripts
/tor-browser
1088 tu
/etc
/apt
/sources.list
"deb http://deb.torproject.org/torproject.org $(debian-codename) main"
1089 gpg
--keyserver keys.gnupg.net
--recv 886DDD89
1090 gpg
--export A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89 | sudo apt-key add
-
1092 pi deb.torproject.org-keyring
1094 /a
/bin
/buildscripts
/tor-browser
1098 /a
/bin
/buildscripts
/tor-browser
1101 pi tor tor-browser-en
1111 fedora todo: disable the firewall or find a way to automate it.
1112 there's an unused section in t.org for tramikssion firewall setup
1114 fedora manual config for nfs:
1116 change to permanent configuration
1117 check the box for nfs
1118 was hard to figure this out, not sure if this is all needed, but
1120 mountd: udp/tcp 20048
1121 portmapper, in firewall-config its called rpc-bind: udp/tcp 111
1122 troubleshooting, unblock things in rpcinfo -p
1123 make sure to reload the firewall to load the persistent configuration
1134 pi nfs-utils || pending_reboot
=true
1136 # this failed until I rebooted
1141 if [[ $HOSTNAME == treetowl
]]; then
1142 # nohide = export filesystems mounted deeper than the export point
1143 # fsid=0 makes this export the "root" export
1144 # not documented in the man page, but this means
1145 # 1. it can be mounted with a shorthand of server:/
1146 # 2. exports that are subdirectories of this one will automatically be mounted
1147 tu
/etc
/exports
<<'EOF'
1148 /k 192.168.1.0/24(rw,fsid=0,nohide,no_root_squash,async,no_subtree_check,insecure)
1157 # persistent virtual machines
1165 # distro may not know about win 10 yet.
1167 if ! virt-install
--os-variant list
&>/dev
/null
; then # we are using a newer virt-install
1168 for v
in 10 8.1 8; do
1169 if osinfo-query os | gr
"^\s*win${v/./\\.}\s" &>/dev
/null
; then
1176 if ! s virsh list
--all --name |
grep -xF win10
&>/dev
/null
; then
1178 # created account with
1179 # win10vmian@outlook.com, and easy to remember password
1180 # win 10 virtio, makes disk way way way faster
1181 # wget https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/latest-virtio/virtio-win.iso
1182 # https://wiki.archlinux.org/index.php/QEMU#Change_Existing_Windows_VM_to_use_virtio
1183 # for installing virtio after initial install instead of with initial iso:
1184 # qemu-img create -f qcow2 fake.qcow2 1G
1185 # --disk=/a/images/virtio-win.iso,device=cdrom \
1186 # --disk=/a/images/fake.qcow2,bus=virtio
1188 # went to device manager, saw 2 pci devices with yellow !,
1189 # did search for drivers, pick cdrom location, done.
1191 # from http://www.tenforums.com/tutorials/4189-fast-startup-turn-off-windows-10-a.html.
1192 # google said there was a control panel option for it, but
1193 # that turned out to be a lie.
1194 # Put this in a .bat file and run as administrator to turn off
1195 # hyberboot which fucks things up.
1196 # REG ADD "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Power" /V HiberbootEnabled /T REG_dWORD /D 0 /F
1197 # power settings, turn off display: never
1198 # run "control userpasswords2", turn on automatic login.
1199 # note: when changing devices, I just undefine, the create the vm again.
1201 s virt-install
--noautoconsole --graphics spice
,listen
=0.0.0.0 \
1202 --disk=/a
/images
/win10.qcow2
,bus
=virtio
--vcpus 2 -r 4096 -w bridge
=br0 \
1203 -n win10
--import --os-variant $variant --cpu host-model-only
1205 s virsh destroy win10
1207 # this one hasn\'t had the virtio fix done yet.
1208 s virt-install
--noautoconsole --graphics spice
,listen
=0.0.0.0 \
1209 --disk=/a
/images
/win7.qcow2
--vcpus 2 -r 4096 -w bridge
=br0 \
1210 -n win7
--import --os-variant win7
--cpu host-model-only
1211 s virsh destroy win7
1212 # had a problem with --cpu host, so trying out
1213 # --cpu host-model-only
1218 if [[ $HOSTNAME == treetowl
]]; then
1220 # note samba re-reads it\'s config every 1 minute
1222 arch
) s
cp /etc
/samba
/smb.conf.default
/etc
/samba
/smb.conf
;;
1225 # add 2 lines after workgroup option
1226 s
sed -ri --follow-symlinks '/^\s*encrypt passwords\s*=/d' /etc
/samba
/smb.conf
1227 s
sed -ri --follow-symlinks '/^\s*map to guest\s*=/d' /etc
/samba
/smb.conf
1228 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
1229 # remove default homes section. not sharing that.
1230 s
sed -ri --follow-symlinks '/^\s*\[homes\]/,/\s*\[/d' /etc
/samba
/smb.conf
1232 if ! grep -xF '[public]' /etc
/samba
/smb.conf
&>/dev
/null
; then
1233 s
tee -a /etc
/samba
/smb.conf
<<'EOF'
1243 # systemd claims it generates units from /etc/init.d, but it
1244 # clearly doesn\'t in debian. I have no idea how they are
1245 # related. fuck debian right now. It\'s not documented. samba
1246 # has a systemd init file linked to /dev/null. There\'s this
1247 # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=769714 which
1248 # claims samba\'s sub-services will be started automatically by
1249 # systemd... it didn\'t on install, wonder if it will on
1250 # boot. It clued me in how to start it manually though. Nothing
1251 # in /usr/share/doc/samba, debian admin guide says nothing about
1252 # any of this. (this is in debian testing as of 4/2016).
1254 s
/etc
/init.d
/samba start
1262 tu
/etc
/hosts
<<< "127.0.1.1 $(hostname).lan $(hostname)"
1265 ######### begin stuff belonging at the end ##########
1268 # Apps we want to override others for default file handler:
1269 # simplest way in debian is to just install them last.
1282 pi
"${simple_packages[@]}"
1285 if $pending_reboot; then
1286 echo "$0: pending reboot and then finished. doing it now."
1289 echo "$0: $(date): ending now)"