failed 9p experiment
[distro-setup] / distro-begin
index aa19cfabc8189dea6d685da71e146d012043648e..dde7c8e6afd9f3c67fa5785b55ae540988680100 100755 (executable)
@@ -20,7 +20,7 @@
 
 # in case we need it,
 # to make ssh interactive shell run better, we run this first.
-sudo bash -c 'source /a/c/repos/bash/.bashrc && source /a/exe/ssh-emacs-setup'
+sudo bash -c 'source /a/c/.bashrc && source /a/exe/ssh-emacs-setup'
 
 
 # usage: $0 [-r] HOSTNAME
@@ -155,6 +155,7 @@ if isfedora; then
     sudo $sed -i 's/^Defaults *requiretty/#\0 # ian commented/' /etc/sudoers
     # turn on magic sysrq commands for this boot cycle
     echo 1 > sudo dd of=/proc/sys/kernel/sysrq
+    echo "kernel.sysrq = 1" > /etc/sysctl.d/90-sysrq.conf
     # selinux is not user friendly. Like, you enable samba, but you haven't run the magic selinux commands so it doesn't work
     # and you have no idea why.
     sudo $sed -i 's/^\(SELINUX=\).*/\1disabled/' /etc/selinux/config
@@ -165,7 +166,7 @@ fi
 # already ran for pxe installs, but used for vps & updates
 distro=$(distro-name)
 case $distro in
-    ubuntu|debian)
+    ubuntu|debian|trisquel)
         sudo bash -c ". /a/bin/fai/fai-wrapper && /a/bin/fai/fai/config/scripts/GRUB_PC/11-ian"
         ;;
     *)
@@ -176,7 +177,7 @@ esac
 
 if linode; then
     sudo $sed -i '/^127\.0\.1\.1/d' /etc/hosts
-    echo "127.0.1.1 $HOSTNAME.lan $HOSTNAME" | sudo tee -a /etc/hosts
+    echo "127.0.1.1 $HOSTNAME.b8.nz $HOSTNAME" | sudo tee -a /etc/hosts
 fi
 
 
@@ -186,23 +187,20 @@ if [[ $EUID == 0 ]]; then
 fi
 
 
-#### begin link bashrc repo for all users ######
-for x in /a/c/repos/bash/!(.git|..|.); do
-    lnf "$x" /home/ian
-    sudo -u traci -i <<EOF
-PATH="/a/exe:$PATH"
-lnf "$x" /home/traci
-EOF
+#### begin link bashrc for root ######
+for x in /a/c/{.bashrc,brc,.bash_profile,.profile,.inputrc,path_add_function}; do
     sudo -i <<EOF
 PATH="/a/exe:$PATH"
 lnf $x /root
 EOF
 done
-#### end link bashrc repo for all users ######
-
+#### end link bashrc repo for root ######
+# this needs to be before installing pacserve so we have gpg conf.
+conflink
 
 set +x
 errallow
+source /etc/profile.d/environment.sh
 source ~/.bashrc
 $interactive || errcatch
 $interactive || set -x
@@ -212,6 +210,9 @@ $interactive || set -x
 tu /etc/sudoers <<'EOF'
 ian  ALL=(ALL)  NOPASSWD: ALL
 Defaults  env_keep += SUDOD
+# makes ubuntu be like debian
+# https://unix.stackexchange.com/a/91572
+Defaults always_set_home
 EOF
 
 
@@ -219,12 +220,9 @@ EOF
 isfedora && tu /etc/sysctl.conf 'kernel.sysrq = 1'
 
 
-# this needs to be before installing pacserve so we have gpg conf.
-conflink
-
-if isdebian; then
-    codename=$(debian-codename)
+if isdeb; then
     if isdebian-stable && has_x; then
+        codename=$(debian-codename)
         s dd of=/etc/apt/sources.list.d/mozilla-iceweasel.list <<EOF
 deb http://mozilla.debian.net/ $codename-backports firefox-release
 deb-src http://mozilla.debian.net/ $codename-backports firefox-release
@@ -288,6 +286,7 @@ pi trash-cli
 
 
 s lnf -T /a/bin /b
+s lnf -T /nocow/t /t
 
 if has_p; then
     lnf -T /p/News ~/News
@@ -298,7 +297,7 @@ s lnf /q/root/.editor-backups /q/root/.undo-tree-history \
 
 rootsshsync
 
-s lnf /a/c/.inputrc /a/c/.vim /a/c/.vimrc /a/c/.gvimrc /root
+s lnf /a/c/.vim /a/c/.vimrc /a/c/.gvimrc /root
 
 # machine is going away
 # if [[ $HOSTNAME == htpc ]]; then
@@ -325,6 +324,11 @@ case $(distro-name) in
                 # I switch to using firefox-esr. note: They seem
                 # to release a new esr version every 9 months or so.
                 pi firefox/unstable
+                s dd of=/etc/apt/preferences.d/firefox <<'EOF'
+Package: firefox
+Pin: release a=unstable
+Pin-Priority: 500
+EOF
             fi
         fi
         # for hosts which require nonfree drivers
@@ -337,12 +341,12 @@ case $(distro-name) in
             pi $p
         fi
         ;;&
-    ubuntu|debian)
+    trisquel|ubuntu|debian)
         if has_x; then
-            if isdebian-stable; then
-                pi xmacro
-            else
+            if isdebian-testing; then
                 pi xmacro/unstable # has no unstable deps
+            else
+                pi xmacro
             fi
             pi gtk-redshift xinput
         fi
@@ -506,17 +510,17 @@ EOF
         fi
 
         ;;&
-    ubuntu|debian|fedora)
+    ubuntu|trisquel|debian|fedora)
         if has_x; then
-            if isdebian-stable; then
-                pi xkbset
-            else
+            if isdebian-testing; then
                 # xkbset was in testing for quite a while, dunno
                 # why it\'s not anymore. Sometime I should check and
                 # see if it\'s back in testing, but the unstable package
                 # doesn\'t upgrade anything form testing, and it\'s tiny
                 # so I\'m not bothering to automate it.
                 pi xkbset/unstable
+            else
+                pi xkbset
             fi
         fi
         ;;&
@@ -604,12 +608,14 @@ EOF
     s dd of=/etc/systemd/system/imount.service <<'EOF'
 [Unit]
 Description=Mount /i and related mountpoints
+Before=syncthing@ian.service
 
 [Service]
 Type=oneshot
 ExecStart=/root/imount
 
 [Install]
+RequiredBy=syncthing@ian.service
 # note /kr needs networking, this target is the simplest way to
 # time it when the network should be up, but not do something
 # dumb like delay startup until the network is up. It happens
@@ -673,7 +679,7 @@ else
 fi
 
 if isubuntu; then
-    # disable crash report annoying crap
+    # disable crash report annoying dialogs.
     s dd of=/etc/default/apport <<<'enabled=0'
 fi
 
@@ -776,8 +782,18 @@ EOF
     fi
     pi dmenu
 
-    if isdeb && (tp || x2); then
-        pi task-laptop
+    if tp || x2; then
+        case $distro in
+            debian)
+                pi task-laptop
+                ;;
+            ubuntu|trisquel)
+                # the exact packages that task-laptop would install, since ubuntu
+                # doesn\'t have this virtual in practice package.
+                pi avahi-autoipd bluetooth powertop iw wireless-tools wpasupplicant
+                ;;
+            # todo: other distros unknown
+        esac
     fi
 fi