diff options
-rw-r--r-- | Install.org | 117 |
1 files changed, 73 insertions, 44 deletions
diff --git a/Install.org b/Install.org index 69fd632..a7d2f0c 100644 --- a/Install.org +++ b/Install.org @@ -1,7 +1,67 @@ #+TITLE: Install -#+PROPERTY: header-args(elisp) :tangle install.el :session install -* Stow all modules +* Introduction +Each heading is a step in the install process. +Run each headings source code snippets as you progress through them. +Any snippets that have the tag =:optional:= can be avoided, and are likely extra functionality that you can use later on. +* Generate user directories +This makes some useful directories that are used by the system and/or by me. +I split these into two sections so at minimum you can install the system folders and generate the user folders if you wish. +** System folders +#+BEGIN_SRC sh +mkdir ~/.local; +mkdir ~/.local/src; +mkdir ~/.local/bin; +mkdir ~/.config; +#+END_SRC +** User folders :optional: +Firstly the essentials for a good user experience™ +#+BEGIN_SRC sh +mkdir ~/Downloads ~/Pictures ~/Music; +#+END_SRC + +Then generate the other stuff that I use (mostly). +#+BEGIN_SRC sh +mkdir ~/Text; +mkdir ~/School; +mkdir ~/Code; +mkdir ~/Code/Learning; +mkdir ~/Code/Projects; +#+END_SRC +* Clone templates :optional: +These are templates coded by me (MIT licensed) which are basically boilerplate helpers for differing languages. +They allow me to quickly start coding up projects as they remove the hassle of setting the build system and source directories up manually. +They're cloned into =~/Code/Templates= not only so you can hack on them as you wish but also so you can generate templates even when offline just by copying the template you want and removing/replacing the '.git' directory in it. + +Firstly you need the folders for the templates to be stored in, so =mkdir= them. +#+BEGIN_SRC sh +mkdir ~/Code; +mkdir ~/Code/Templates; +#+END_SRC + +Then clone the templates into the folder. +#+BEGIN_SRC sh +declare -a templates=("CTemplate" "CPPTemplate" "PythonTemplate" + "NodeTemplate" "ArduinoTemplate"); +for template in ${templates[@]}; do + git clone https://github.com/odavep/$template ~/Code/Templates/$template; +done +#+END_SRC +* Managing modules +** What is stow? +GNU/Stow is a utility for symlinking folders (named as 'modules') to the home directory. +** How does stow work (roughly)? +Each module must be structure as if that module directory were to be mapped directly on to the home directory. +For example, the vim module which has only a vimrc file would be structured "~/Dotfiles/Vim/.vimrc" so that when it is stowed, the vimrc goes directly to "~/.vimrc" +This also means that if any files are already present that conflict with the module files, the stow will not work. +So make sure to clean up beforehand. +** Activating a module +Activating a module is as simple as just entering the dotfiles directory and entering 'stow <Module name>'. +This will symlink the contents of the internal directory to the home directory. +** Deleting a module +Deleting a module is a call to stow with the -d argument (i.e. 'stow -D <module name>'). +This will delete the symlinks to all the files in the module, leaving the home directory clean of them. +** Activate all modules :optional: Basically get all folders excluding the '.git' and '.' folder, then just stow them. #+BEGIN_SRC sh folders=`find . -maxdepth 1 -type 'd' -not -name '.git' -not -name '.'`; @@ -12,24 +72,30 @@ for pkg in $folders; do stow $pkg done #+END_SRC -* Emacs support +* Emacs support :optional: +:PROPERTIES: +:header-args: :session *install* :results none :tangle Install.el +:END: ** Get all modules in Dotfiles The main function used to retrieve all the stowable modules in the Dotfiles directory. #+BEGIN_SRC elisp (defun +dotfiles-install/get-modules () + "Get all modules in dotfiles directory" (interactive) (cdr (reverse (split-string - (shell-command-to-string "find . -maxdepth 1 -type 'd' -not -name '.git' -not -name '.'") + (shell-command-to-string "find ~/Dotfiles/ -maxdepth 1 -type 'd' -not -name '.git' -not -name '$USER/Dotfiles/'") "\n")))) +(+dotfiles-install/get-modules) #+END_SRC ** Install module Little elisp snippet to stow a specific module in the Dotfiles folder using completing-read. #+BEGIN_SRC elisp (defun +dotfiles-install/install-module () (interactive) - (async-shell-command (format "stow %s" (completing-read "Stow module: " (get-modules) nil t)) "*stow-output*" "*stow-error*")) + (async-shell-command (format "stow %s" (completing-read "Stow module: " (+dotfiles-install/get-modules) nil t)) "*stow-output*" "*stow-error*")) +(+dotfiles-install/install-module) #+END_SRC ** Delete module Little elisp snippet to delete a stowed module in the Dotfiles folder using completing-read. @@ -37,44 +103,7 @@ Little elisp snippet to delete a stowed module in the Dotfiles folder using comp (defun +dotfiles-install/delete-module () (interactive) (async-shell-command - (format "stow -D %s" (completing-read "Delete module: " (get-modules) nil t)) + (format "stow -D %s" (completing-read "Delete module: " (+dotfiles-install/get-modules) nil t)) "*stow-output*" "*stow-error*")) -#+END_SRC -* Generate user directories -This makes some useful directories that are used by the system and/or by me. -I split these into two sections so you can execute the ones you think are useful. -** System folders -#+BEGIN_SRC sh -mkdir ~/.local; -mkdir ~/.local/src; -mkdir ~/.local/bin; - -mkdir ~/.config; -#+END_SRC -** User folders -Firstly the essentials for a good user experience™ -#+BEGIN_SRC sh -mkdir ~/Downloads ~/Pictures ~/Music; -#+END_SRC - -Then generate the other stuff that I use (mostly). -#+BEGIN_SRC sh -mkdir ~/Text; -mkdir ~/School; -mkdir ~/Code; -mkdir ~/Code/Learning; -mkdir ~/Code/Projects; -mkdir ~/Code/Templates; -#+END_SRC -* Clone templates -These are templates coded by me (MIT licensed) which are basically boilerplate helpers for differing languages. -They allow me to quickly start coding up projects as they remove the hassle of setting the build system and source directories up manually. -They're cloned into =~/Code/Templates= not only so you can hack on them as you wish but also so you can generate templates even when offline just by copying the template you want and removing/replacing the '.git' directory in it. - -#+BEGIN_SRC sh -declare -a templates=("CTemplate" "CPPTemplate" "PythonTemplate" - "NodeTemplate" "ArduinoTemplate"); -for template in ${templates[@]}; do - git clone https://github.com/odavep/$template ~/Code/Templates/$template; -done +(+dotfiles-install/delete-module) #+END_SRC |