2 # Copyright (C) 2016 Ian Kelling
3 # This program is under GPL v. 3 or later, see <http://www.gnu.org/licenses/>
5 # todo. dunno why, but original bootstrap of timezone is not sticking.
7 # s dpkg-reconfigure tzdata
11 # for bootstrapping a new machine
13 # to make ssh run better, first run this:
14 sudo bash
-c 'source /a/c/repos/bash/.bashrc && source /a/exe/ssh-emacs-setup'
17 # see t.org for OS installer notes
19 # usage: $0 [OPTIONS] HOSTNAME
22 # run any sudo command first so your pass is cached
23 # set the scrollback to unlimited in case something goes wrong
25 if [[ $EUID == 0 ]]; then
26 if getent passwd ian
; then
27 echo "$0: error: running as root. unprivileged user exists. use it."
30 echo "$0: warning: running as root. I will setup users then exit"
34 interactive
=false
# set this to true if running by hand in emacs
35 [[ $
- == *i
* ]] || interactive
=false
37 if ! $interactive; then
42 trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?"' ERR
44 exec &> >(sudo
tee -a /var
/log
/distro-begin
)
45 echo "$0: $(date): starting now)"
47 # headless=false # unused atm
49 # for copying to a new data fs
50 bootstrapfs
=false
# old flag, needs new look before using.
51 while [[ $1 == -* ]]; do
53 # avoid some of the longer compilation steps,
54 # when we need to rerun because we had an error
55 -r) recompile
=true
; shift ;;
63 for f
in iank-dev htpc treetowl x2 frodo tp li lj
; do
64 eval "$f() { [[ $HOSTNAME == $f ]]; }"
66 has_p
() { iank-dev || x2 || frodo || tp
; }
67 has_x
() { ! { lj || li
; }; }
68 encrypted
() { has_p
; }
71 export GLOBIGNORE
=*/.
:*/..
75 ####### end command line parsing
79 # I tried making a service which was dependent on reboot.target,
80 # but it happened too late in the shutdown process.
81 sudo
dd of
=/etc
/systemd
/system
/keyscripton.service
<<'EOF'
83 Description=Turn on automatic decryption of drives on boot
84 # tried using graphical.target, but it made my display manager restart before rebooting.
85 # generally, I don't think targets order shutdown like they do startup.
86 # So, I did systemd-analyze plot > something.svg, and picked a reliably started
87 # service that happens late in the game.
89 DefaultDependencies=no
90 Conflicts=reboot.target
96 ExecStop=/a/exe/keyscript-on
99 WantedBy=keyscriptoff.service
101 sudo systemctl daemon-reload
# needed if the file was already there
102 sudo systemctl stop keyscripton.service
103 # sudo systemctl start keyscripton.service
104 sudo systemctl
enable keyscripton.service
106 sudo
dd of
=/etc
/systemd
/system
/keyscriptoff.service
<<'EOF'
108 Description=Turn off automatic decryption of drives on boot
112 ExecStart=/a/exe/keyscript-off
115 WantedBy=multi-user.target
117 sudo systemctl daemon-reload
# needed if the file was already there
118 sudo systemctl
enable keyscriptoff.service
119 sudo systemctl start keyscriptoff.service
126 desktop
=$
(ssh root@iankelling.org
grep desktop
/etc
/hosts |
grep -o "^.* ")
127 if $bootstrapfs; then
128 # for bootstrapping at a new job:
130 # for moving to a new hd, change $cp to move between filesystems
132 chown
-R ian
:ian
/a
# probably needs to be removed
134 $cp/a
/c
/bin
/{bash-programs-by-ian
,distro-begin
,distro-functions
,input-setup.sh
} /a
/bin
135 echo -e \\n
\\n
\\n | ssh-keygen
-t rsa
139 # this script has been designed to be idempotent
140 # todo, it would be nice to cut down on some of the output
143 for x
in /a
/bin
/errhandle
/*-function; do
149 $interactive || errcatch
151 source /a
/bin
/distro-functions
/src
/identify-distros
152 $interactive ||
set -x
157 # comment out line disallowing calling sudo in scripts
158 sudo
sed -i 's/^Defaults *requiretty/#\0 # ian commented/' /etc
/sudoers
159 # turn on magic sysrq commands for this boot cycle
160 echo 1 > sudo
dd of
=/proc
/sys
/kernel
/sysrq
161 # selinux is not user friendly. Like, you enable samba, but you haven't run the magic selinux commands so it doesn't work
162 # and you have no idea why.
163 sudo
sed -i 's/^\(SELINUX=\).*/\1disabled/' /etc
/selinux
/config
164 selinuxenabled
&& sudo setenforce
0
168 # already ran for pxe installs, but used for vps & updates
169 distro
=$
(distro-name
)
172 sudo bash
-c ". /a/bin/fai/fai-wrapper && /a/bin/fai/fai/config/scripts/GRUB_PC/11-ian"
175 sudo bash
-c ". /a/bin/fai/fai-wrapper &&
176 /a/bin/fai/fai/config/distro-install-common/end"
181 if [[ $EUID == 0 ]]; then
182 echo "$0: running as root. exiting now that users are setup"
190 # $2 and opts are unused so far.
192 while [[ $1 == -* ]]; do
196 lnf
${opts[@]} "$1" /home
/ian
/$2
197 sudo
-u traci
-i <<EOF
199 lnf ${opts[@]} "$1" /home/traci/$2
203 for x
in /a
/c
/repos
/bash
/!(.git
); do
217 $interactive || errcatch
218 $interactive ||
set -x
222 tu
/etc
/sudoers
<<'EOF'
223 ian ALL=(ALL) NOPASSWD: ALL
224 Defaults env_keep += SUDOD
228 # enable magic sysrq keys. debian docs say it is already enabled by default
229 isfedora
&& tu
/etc
/sysctl.conf
'kernel.sysrq = 1'
234 codename
=$
(debian-codename
)
235 # non-existent var, as Im not planning to use stable right now
236 if isdebian-stable
; then
238 s
dd of
=/etc
/apt
/sources.list.d
/mozilla-iceweasel.list
<<EOF
239 deb http://mozilla.debian.net/ $codename-backports firefox-release
240 deb-src http://mozilla.debian.net/ $codename-backports firefox-release
244 # we change the mirror from the default, so we cant use tu
245 s
dd of
=/etc
/apt
/sources.list.d
/main-backports.list
<<EOF
246 deb http://http.debian.net/debian $codename-backports main contrib non-free
247 deb-src http://http.debian.net/debian $codename-backports main contrib non-free
251 # take care of mozilla signing errors in previous command
252 pi pkg-mozilla-archive-keyring
256 # this would change stable to testing, but I set that up already.
257 # It\'s just a no-op if its already testing.
258 # sudo sed -ri 's!^( *[^ #]+ +[^ ]+ +)[[:alpha:]]+(.*)!\1testing\2!' /etc/apt/sources.list
264 #https://wiki.archlinux.org/index.php/Arch_User_Repository#Installing_packages
265 sudo pacman
-S --noconfirm --needed base-devel jq
266 # pacaur seems to be the best, although it + cower has a few minor bugs,
267 # its design goals seem good, so, going for it.
274 makepkg
-sri --skippgpcheck --noconfirm
281 # for aur, automatically dl & add gpg keys.
282 # Just the keyserver-options line goes in dirmngr.conf once
283 # this bug is fixed: https://bugs.gnupg.org/gnupg/issue2147
284 for homedir
in /home
/*; do
285 # this creates ~/.gnupg. addgnupghome is kinda broken on arch.
287 teeu
$homedir/.gnupg
/gpg.conf
<<EOF
288 $(grep -o '^ *keyserver .*' $homedir/.gnupg/dirmngr.conf)
289 keyserver-options auto-key-retrieve
293 x
=$
(mktemp
); /a
/opt
/pacman.conf-insert_pacserve
>$x
294 sudo
dd of
=/etc
/pacman.conf
if=$x; rm $x
295 sudo systemctl
enable pacserve.service
296 sudo systemctl start pacserve.service
298 # strange error if just installing trash-cli: "pyalpm requires python",
299 # so I see that it requires python2, and installing that manually fixes it.
300 # I didn't see this on earlier installation, main thing which changed was
301 # pacserve, so not sure if it's related.
309 ###### link files ###########
310 # convenient to just do all file linking in one place
312 # if it wasn't set already, we could set hostname here
313 #echo treetowl | s dd of=/etc/hostname
314 #s hostname -F /etc/hostname
315 #HOSTNAME=$(hostname)
317 #########################################
318 # NOTE: only /a needs to be mounted for creating links!
319 ###########################################
321 # todo: reconcile ~/.ssh/config work/home
327 lnf
-T /p
/offlineimap ~
/Maildir
328 lnf
-T /p
/News ~
/News
329 # don't use /* because I don't want to require it to be mounted
332 s lnf
/q
/root
/.editor-backups
/q
/root
/.undo-tree-history \
333 /a
/opt
/a
/c
/.emacs.d
$HOME/mw_vars
/k
/backup
/root
335 d
=/q
/p
/c
/machine_specific
/$HOSTNAME/.unison
336 if ! s
test -L /root
/.unison
&& [[ ! $
(s
find /root
/.unison
-prune -empty) ]]; then
338 s chown
-R $USER:$USER /root
/.unison
339 mv -f /root
/.unison
/* $d
341 s lnf
-T $d /root
/.unison
346 s lnf
/a
/c
/.inputrc
/a
/c
/.vim
/a
/c
/.vimrc
/a
/c
/.gvimrc
/root
348 # machine is going away
349 # if [[ $HOSTNAME == htpc ]]; then
350 # lnf -T /i/Videos ~/Downloads
355 lnf
-T /i
/k
/mboxes ~
/mail
359 # basic needed packages
360 case $
(distro-name
) in
363 if isdebian-stable
; then
364 pi firefox
/$codename-backports
366 pi firefox
/unstable
# has no unstable dependencies
369 # for hosts which require nonfree drivers
372 *) pi linux-image-amd64 firmware-linux-nonfree \
373 firmware-linux-free linux-headers-amd64
379 pi xmacro gtk-redshift xinput
383 p
-y groupinstall development-tools c-development books admin-tools
387 # debian has this package patched to work, upstream is dead
388 # tried using alien, pi alien, alien -r *.deb, rpm -Uhv *.rpm, got this error, so fuck it
389 # file /usr/bin from install of xmacro-0.3pre_20000911-7.x86_64 conflicts with file from package filesystem-3.2-19.fc20.x86_64
390 # http://packages.debian.org/source/sid/xmacro
391 pi
patch libXtst-devel
393 wget http
://ftp.de.debian.org
/debian
/pool
/main
/x
/xmacro
/xmacro_0.3pre-20000911.orig.
tar.gz
394 wget http
://ftp.de.debian.org
/debian
/pool
/main
/x
/xmacro
/xmacro_0.3pre-20000911-6.
diff.gz
396 patch -p0 < xmacro_0.3pre-20000911-6.
diff
397 cd xmacro-0.3pre-20000911.orig
399 sleep 1 # not sure why the following command couldn\'t find, so trying this
400 # no make install target
401 s
cp -f xmacroplay xmacrorec xmacrorec2
/usr
/local
/bin
409 # libxtst is missing dep https://aur.archlinux.org/packages/xmacro/#news
410 pi xorg-server redshift xorg-xinput libxtst xmacro
413 # https://aur.archlinux.org/packages/xkbset/#comment-545419
416 -----BEGIN CERTIFICATE-----
417 MIIJADCCB+igAwIBAgIRAIVAhZ0TMbQ5jTm0koI8X6YwDQYJKoZIhvcNAQELBQAw
418 djELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAk1JMRIwEAYDVQQHEwlBbm4gQXJib3Ix
419 EjAQBgNVBAoTCUludGVybmV0MjERMA8GA1UECxMISW5Db21tb24xHzAdBgNVBAMT
420 FkluQ29tbW9uIFJTQSBTZXJ2ZXIgQ0EwHhcNMTUxMjA4MDAwMDAwWhcNMTgxMjA3
421 MjM1OTU5WjCBsTELMAkGA1UEBhMCVVMxDjAMBgNVBBETBTY1MjExMREwDwYDVQQI
422 EwhNaXNzb3VyaTERMA8GA1UEBxMIQ29sdW1iaWExHzAdBgNVBAkTFjExMDAgQ2Fy
423 cmllIEZyYW5ja2UgRHIxHzAdBgNVBAoTFlV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1ghdyZXBlYy5lY29uLm1p
456 c3NvdXJpLmVkdYIUc2NhbmxhYi5taXNzb3VyaS5lZHWCFnNzc2MuY29hcy5taXNz
457 b3VyaS5lZHWCF3RlYWNoLmNvYXMubWlzc291cmkuZWR1ghd0b3B0ZWFjaGVyLm1p
458 c3NvdXJpLmVkdYIQdnNmLm1pc3NvdXJpLmVkdYIid2hpdGVwYXBlci5ncmFkc2No
459 b29sLm1pc3NvdXJpLmVkdTANBgkqhkiG9w0BAQsFAAOCAQEAQutYVAqG7MpmG2Nu
460 Z/UypjYkN4JvwRbKBpTrce2IT/Sy29x6chBbyD+0WE6QORBtaUHuzE1KoXqpnF4M
461 QrkKw0oBAC6x9dISoomq0DkIndtoBYYLaxSoII6F4OGWgF7pQ/7MiCBYzsKQpn9t
462 aofMcTfvnCjq+MCIaeYnUKBVww0lOJlUxZGKxFJvRpf78HfbBauojjRO2zXLZD/u
463 KMspbTfDaj5etIgWGShY2eml3N/SjAENmZYkcgDBYFyi8CckcEBAVzpH1+D+7Anz
464 txHSYDNHAYLv83MwbegApa1FwPqlG/4SdEU8G6e6Xf5GLC/6GPGVTUpr7o348OOO
466 -----END CERTIFICATE-----
467 -----BEGIN CERTIFICATE-----
468 MIIF+TCCA+GgAwIBAgIQRyDQ+oVGGn4XoWQCkYRjdDANBgkqhkiG9w0BAQwFADCB
469 iDELMAkGA1UEBhMCVVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0pl
470 cnNleSBDaXR5MR4wHAYDVQQKExVUaGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNV
471 BAMTJVVTRVJUcnVzdCBSU0EgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMTQx
472 MDA2MDAwMDAwWhcNMjQxMDA1MjM1OTU5WjB2MQswCQYDVQQGEwJVUzELMAkGA1UE
473 CBMCTUkxEjAQBgNVBAcTCUFubiBBcmJvcjESMBAGA1UEChMJSW50ZXJuZXQyMREw
474 DwYDV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ZlUp5uH5gIjppIG8GLWZqjV5vbhvhZQPwZsHURKsISNrqOcooGTie3jVgU0W+0
491 +Wj8mN2knCVANt69F2YrA394gbGAdJ5fOrQmL2pIhDY0jqco74fzYefbZ/VS29fR
492 5jBxu4uj1P+5ZImem4Gbj1e4ZEzVBhmO55GFfBjRidj26h1oFBHZ7heDH1Bjzw72
493 hipu47Gkyfr2NEx3KoCGMLCj3Btx7ASn5Ji8FoU+hCazwOU1VX55mKPU1I2250Lo
494 RCASN18JyfsD5PVldJbtyrmz9gn/TKbRXTr80U2q5JhyvjhLf4lOJo/UzL5WCXED
495 Smyj4jWG3R7Z8TED9xNNCxGBMXnMete+3PvzdhssvbORDwBZByogQ9xL2LUZFI/i
496 eoQp0UM/L8zfP527vWjEzuDN5xwxMnhi+vCToh7J159o5ah29mP+aJnvujbXEnGa
497 nrNxHzu+AGOePV8hwrGGG7hOIcPDQwkuYwzN/xT29iLp/cqf9ZhEtkGcQcIImH3b
498 oJ8ifsCnSbu0GB9L06Yqh7lcyvKDTEADslIaeSEINxhO2Y1fmcYFX/Fqrrp1WnhH
499 OjplXuXE0OPa0utaKC25Aplgom88L2Z8mEWcyfoB7zKOfD759AN7JKZWCYwk
500 -----END CERTIFICATE-----
501 -----BEGIN CERTIFICATE-----
502 MIIF3jCCA8agAwIBAgIQAf1tMPyjylGoG7xkDjUDLTANBgkqhkiG9w0BAQwFADCB
503 iDELMAkGA1UEBhMCVVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0pl
504 cnNleSBDaXR5MR4wHAYDVQQKExVUaGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNV
505 BAMTJVVTRVJUcnVzdCBSU0EgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMTAw
506 MjAxMDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBiDELMAkGA1UEBhMCVVMxEzARBgNV
507 BAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDa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tHzoBN6J2/FNQwISbxmtOuowhT6KO
524 VWKR82kV2LyI48SqC/3vqOlLVSoGIG1VeCkZ7l8wXEskEVX/JJpuXior7gtNn3/3
525 ATiUFJVDBwn7YKnuHKsSjKCaXqeYalltiz8I+8jRRa8YFWSQEg9zKC7F4iRO/Fjs
526 8PRF/iKz6y+O0tlFYQXBl2+odnKPi4w2r78NBc5xjeambx9spnFixdjQg3IM8WcR
527 iQycE0xyNN+81XHfqnHd4blsjDwSXWXavVcStkNr/+XeTWYRUc+ZruwXtuhxkYze
528 Sf7dNXGiFSeUHM9h4ya7b6NnJSFd5t0dCy5oGzuCr+yDZ4XUmFF0sbmZgIn/f3gZ
529 XHlKYC6SQK5MNyosycdiyA5d9zZbyuAlJQG03RoHnHcAP9Dc1ew91Pq7P8yF1m9/
530 qS3fuQL39ZeatTXaw2ewh0qpKJ4jjv9cJ2vhsE/zB+4ALtRZh8tSQZXq9EfX7mRB
531 VXyNWQKV3WKdwrnuWih0hKWbt5DHDAff9Yk2dDLWKMGwsAvgnEzDHNb842m1R0aB
532 L6KCq9NjRHDEjf8tM7qtj3u1cIiuPhnPQCjY/MiQu12ZIvVS5ljFH4gxQ+6IHdfG
533 jjxDah2nGN59PRbxYvnKkKj9
534 -----END CERTIFICATE-----
536 cat /etc
/ssl
/certs
/ca-certificates.crt
>> $cert
537 CURL_CA_BUNDLE
=$cert pi xkbset
541 ubuntu|debian|fedora
)
552 # enables trim for volume delete, other rare commands.
553 sudo
sed -ri 's/( *issue_discards\b).*/\1 = 1/' /etc
/lvm
/lvm.conf
557 sudo
cp /usr
/share
/doc
/util-linux
/examples
/fstrim.
{service
,timer
} /etc
/systemd
/system
560 sudo systemctl
enable fstrim.timer
563 dirs=(/mnt
/{1,2,3,4,5,6,7,8,9})
564 s mkdir
-p "${dirs[@]}"
565 s chown ian
:ian
"${dirs[@]}"
567 if [[ $HOSTNAME == treetowl
]]; then
568 tu
/etc
/fstab
<<'EOF'
569 UUID=3f7b31cd-f299-40b4-a86b-7604282e2715 /i btrfs noatime 0 2
572 tu
/etc
/fstab
<<'EOF'
573 /q/i /i none bind 0 0
577 tu
/etc
/fstab
<<'EOF'
578 /i/w /w none bind 0 0
579 /i/k /k none bind 0 0
582 if ! mountpoint
/kfrodo
; then
584 s chown ian
:traci
/kfrodo
586 if [[ $HOSTNAME == frodo
]]; then
587 tu
/etc
/fstab
<<'EOF'
588 /k /kfrodo none bind 0 0
591 tu
/etc
/fstab
<<'EOF'
592 frodo:/k /kfrodo nfs defaults 0 0
596 s mkdir
-p /q
/i
/{w
,k
}
597 for dir
in /{i
,w
,k
}; do
598 if mountpoint
$dir; then continue; fi
605 # ssh and probably some other things care about parent directory
606 # ownership, and ssh doesn\'t allow any group writable parent
607 # directories, so we are forced to use a directory structure similar
608 # to home directories
613 # it comes with stretch and arch, but not jessie.
614 # propogate /etc/udev/hwdb.d
615 if which systemd-hwdb
; then
616 s systemd-hwdb update
617 ser restart systemd-udev-trigger
620 # work desktop doesnt need gpg stuff, but it doesnt hurt
621 s
dd of
=/etc
/profile.d
/environment.sh
<<'EOF'
622 # IAN: EDIT THIS FROM /a/bin/distro-setup/distro-begin
624 if [ -f $HOME/path_add-function ]; then
625 . $HOME/path_add-function
626 path_add /usr/sbin /usr/local/sbin /sbin
627 path_add /a/exe /a/opt/bin $HOME/.cabal/bin
629 if [ -r /etc/alternatives/java_sdk ]; then
630 export JAVA_HOME=/etc/alternatives/java_sdk
631 path_add /etc/alternatives/java_sdk
635 export EDITOR="emacsclient"
636 # this makes emacsclient file/-c start a server instance if none is running,
637 # instead of some alternate editor logic
638 export ALTERNATE_EDITOR=""
640 # ubuntu starts gpg agent automatically with /etc/X11/Xsession.d/90gpg-agent.
641 # fedora doesn't, which left me to figure this out, and google was no help.
642 # fedora documentation is often quite bad :(
643 # This is mostly copied from that file.
644 # Main difference is that we eval the result of starting gpg-agent,
645 # while that file executes it through xsession specific var.
646 # Also make sourcing the pidfile make more sense.
647 # End result should be the same afaik.
648 # for gpg-agent to work when calling gpg from the command line,
649 # we need an environment variable that is setup via the eval.
650 # which is why we do this upon login, so it can propogate
651 # It is also written to the file $HOME/.gnupg/gpg-agent-info-$(hostname)
652 # I'm not aware if that is ever used, but just fyi.
653 # I also added the bit about xmessaging the stderr,
654 # because I'd like to know if the command fails
655 if [ -f /etc/fedora-release ]; then
656 : ${GNUPGHOME=$HOME/.gnupg}
658 GPGAGENT=/usr/bin/gpg-agent
659 PID_FILE="$GNUPGHOME/gpg-agent-info-$(hostname)"
661 if ! $GPGAGENT 2>/dev/null; then
663 eval "$($GPGAGENT --homedir /p/do-not-delete --daemon --sh --write-env-file=$PID_FILE 2>$temp)"
664 temperr="$(<"$temp")"
665 [ -n "$temperr" ] && xmessage "gpg-agent stderr: $temperr"
666 elif [ -r "$PID_FILE" ]; then
668 export GPG_AGENT_INFO
672 # ubuntu has 002, debian has 022.
673 # from what I've read, benefit of 002 makes shared groups read/write.
674 # Security concern is where some unixes put everyone in a same group,
675 # so if you copy files there with exact perms, that is probably not
676 # what you want. I don't use a system like that, and I don't really care
677 # either way, but I'd prefer
678 # being able to sync file perms with ubuntu systems at work,
679 # and it's easier to change the debian one.
689 # disable crash report annoying crap
690 s
dd of
=/etc
/default
/apport
<<<'enabled=0'
695 # install so it's build dependencies don't get removed.
697 # emacs git build is currently broken
702 makepkg -si --noconfirm
708 pi hunspell hunspell-en
710 # to disable emacs git build,
711 # s apt-get install emacs
713 /a/bin/buildscripts/emacs -u
715 /a/bin/buildscripts/emacs -r
719 # todo, figure this out for arch if we ever try out gnome.
721 # install for multiple display managers in case we use one
725 # fedora didn\'t have the 3.
728 s mkdir -p $dir/PostLogin
729 s command cp /a/bin/desktop-20-autostart.sh $dir/PostLogin/Default
730 s mkdir /etc/lightdm/lightdm.conf.d
731 s dd of=/etc/lightdm/lightdm.conf.d/12-ian.conf <<'EOF'
733 session-setup-script=/a/bin/desktop-20-autostart.sh
739 # todo, also note for work comp, scp opt/org-mode bin/build-scripts
741 # use the package manger version to install the cabal version
744 PATH="$PATH:$HOME/.cabal/bin"
746 # todo, on older ubuntu I used cabal xmonad + xfce,
747 # see /a/bin/old-unused/xmonad-cabal.sh
749 # trying out the distros versions newer distros
752 # for displaying error messages.
753 # optional dependency in arch, standard elsewhere.
754 pi xorg-xmessage xmonad-contrib xorg-xsetroot xorg-xinit
756 # https://wiki.archlinux.org/index.php/Xinitrc
757 for homedir in /home/*; do
758 cp /etc/X11/xinit/xinitrc $homedir/.xinitrc
759 sed -ri '/^ *twm\b/,$d' $homedir/.xinitrc
760 echo "source /a/bin/xinitrc" | tee -a $homedir/.xinitrc
767 if isdeb && (tp || x2); then
772 # the first pup command can kill off our /etc/
773 /a/bin/ssh-emacs-setup
774 echo "$0: $(date): ending now"