]> git.donarmstrong.com Git - bin.git/blobdiff - new_home_directory
add reset usb bus command
[bin.git] / new_home_directory
index 7118ac140042fa922f70d748620c73879ddaa0f7..3e492a37c7da0ff6bf9a4fc72a2349f38b44a489 100755 (executable)
@@ -1,7 +1,11 @@
 #!/bin/sh
 
+# wget -O new_home_directory 'http://git.donarmstrong.com/?p=bin.git;a=blob_plain;f=new_home_directory;hb=HEAD'
+# sh new_home_directory;
+
+
 # makes a new home directory; defaults to one that does not use ssh
-GIT_BASE=http://git.donarmstrong.com/
+GIT_BASE=https://git.donarmstrong.com/
 
 if [ "$1" = "ssh" ]; then
     GIT_BASE=git+ssh://git.donarmstrong.com/srv/git/
@@ -14,19 +18,37 @@ for pkg in mr vcsh; do
         echo "Package $pkg doesn't exist; getting it"
         mkdir -p local_packages/$pkg;
         (cd local_packages/$pkg;
-            apt-get download $pkg;
-            dpkg-deb -x $pkg*.deb .
+         deb_name=$pkg
+         if [ $pkg == "mr"; ]; then
+             deb_name=myrepos
+         fi;
+         if which apt-get >/dev/null 2>&1; then
+             apt-get download $deb_name;
+             dpkg-deb -x ${deb_name}*.deb .
+         else
+             # ok, this host isn't Debian.
+             if [ "$pkg" == "mr" ]; then
+                 wget http://http.debian.net/debian/pool/main/m/myrepos/myrepos_1.20160123_all.deb
+                 ar p myrepos*.deb data.tar.xz|xz --decompress|tar -x
+             elif [ "$pkg" == "vcsh" ]; then
+                 wget http://http.debian.net/debian/pool/main/v/vcsh/vcsh_1.20151229-1_all.deb
+                 ar p vcsh*.deb data.tar.xz|xz --decompress|tar -x
+             fi;
+             
+         fi;
         );
         mkdir -p bin
         ln ~/local_packages/$pkg/usr/bin/$pkg bin/$pkg -s
         if [ "$pkg" == "mr" ]; then
-            echo "include = cat ~/local_packages/$pkg/usr/share/mr/*" >> ~/.mrconfig
+            echo -e "[DEFAULT]\ninclude = cat ~/local_packages/$pkg/usr/share/mr/*" >> ~/.mrconfig
         fi;
+        PATH="$HOME/local_packages/$pkg/usr/bin/:$PATH"
+        export PATH
     fi;
 done;
 
 # .config is currently a link; this indicates that we are dealing with my old configuration system
-for a in .zsh .config; do
+for a in .config; do
     if [ -L ${a} ]; then
         mv ${a} ${a}_bak;
         mkdir -p ${a};
@@ -49,9 +71,28 @@ if [ "$1" = "ssh" ]; then
 else 
     vcsh clone $GIT_BASE/mr.git mr;
 fi;
+
 mr checkout;
+
+for a in .zsh .ssh; do
+    if [ -L ${a} ]; then
+        mv ${a} ${a}_bak;
+        mr up;
+        mkdir -p ${a};
+        cp -r ${a}_bak/* ${a}/;
+    fi;
+done;
+
 if [ ! -e .ssh/authorized_keys ]; then
-    (cd .ssh/; ln authorized_keys_default authorized_keys -s;)
+    (cd .ssh/; ln authorized_keys_default authorized_keys -s; )
+fi;
+
+if [ ! -e ~/bin/.git ]; then
+    # OK, bin must have already existed; check it out directly
+    mv bin bin.tmp;
+    PATH=~/bin.tmp:$PATH mr checkout bin;
+    mv bin.tmp/* bin;
+    rmdir bin.tmp;
 fi;
 
 # do some cleanup; you might want to run git reset --hard in some
@@ -59,3 +100,10 @@ fi;
 # that should be kept
 mr run git reset --soft origin/master
 mr up
+
+# move mr and vcsh to ~/bin if they are in ~/bin.bak
+for pkg in mr vcsh; do
+    if [ -e ~/bin.bak/$pkg ]; then
+        mv ~/bin.bak/$pkg ~/bin/;
+    fi;
+done;