From be65d03f5f3155c812f1c4c5c335821afa0b89a9 Mon Sep 17 00:00:00 2001 From: Adam Gausmann Date: Tue, 29 Jan 2019 16:19:46 -0600 Subject: [PATCH] Add skeleton for new installation system --- Pipfile | 19 ++++++++++++++ Pipfile.lock | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++++ install | 13 ++-------- install.py | 35 +++++++++++++++++++++++++ 4 files changed, 129 insertions(+), 11 deletions(-) create mode 100644 Pipfile create mode 100644 Pipfile.lock create mode 100755 install.py diff --git a/Pipfile b/Pipfile new file mode 100644 index 0000000..dafab2b --- /dev/null +++ b/Pipfile @@ -0,0 +1,19 @@ +[[source]] + +url = "https://pypi.python.org/simple" +verify_ssl = true +name = "pypi" + + +[packages] + +mako = "*" + + +[dev-packages] + + + +[requires] + +python_version = "3.6" diff --git a/Pipfile.lock b/Pipfile.lock new file mode 100644 index 0000000..7345608 --- /dev/null +++ b/Pipfile.lock @@ -0,0 +1,73 @@ +{ + "_meta": { + "hash": { + "sha256": "5f2a777077fa545ffa7e39a4b62c35aae42497d7e4786940f3e4b79fac2c5737" + }, + "host-environment-markers": { + "implementation_name": "cpython", + "implementation_version": "3.6.5", + "os_name": "posix", + "platform_machine": "x86_64", + "platform_python_implementation": "CPython", + "platform_release": "4.19.9-gentoo", + "platform_system": "Linux", + "platform_version": "#20 SMP PREEMPT Sun Jan 27 17:32:41 CST 2019", + "python_full_version": "3.6.5", + "python_version": "3.6", + "sys_platform": "linux" + }, + "pipfile-spec": 6, + "requires": { + "python_version": "3.6" + }, + "sources": [ + { + "name": "pypi", + "url": "https://pypi.python.org/simple", + "verify_ssl": true + } + ] + }, + "default": { + "mako": { + "hashes": [ + "sha256:4e02fde57bd4abb5ec400181e4c314f56ac3e49ba4fb8b0d50bba18cb27d25ae" + ], + "version": "==1.0.7" + }, + "markupsafe": { + "hashes": [ + "sha256:efdc45ef1afc238db84cb4963aa689c0408912a0239b0721cb172b4016eb31d6", + "sha256:52ccb45e77a1085ec5461cde794e1aa037df79f473cbc69b974e73940655c8d7", + "sha256:525396ee324ee2da82919f2ee9c9e73b012f23e7640131dd1b53a90206a0f09c", + "sha256:5c3fbebd7de20ce93103cb3183b47671f2885307df4a17a0ad56a1dd51273d36", + "sha256:f82e347a72f955b7017a39708a3667f106e6ad4d10b25f237396a7115d8ed5fd", + "sha256:31cbb1359e8c25f9f48e156e59e2eaad51cd5242c05ed18a8de6dbe85184e4b7", + "sha256:edce2ea7f3dfc981c4ddc97add8a61381d9642dc3273737e756517cc03e84dd6", + "sha256:19f637c2ac5ae9da8bfd98cef74d64b7e1bb8a63038a3505cd182c3fac5eb4d9", + "sha256:98e439297f78fca3a6169fd330fbe88d78b3bb72f967ad9961bcac0d7fdd1550", + "sha256:fb7c206e01ad85ce57feeaaa0bf784b97fa3cad0d4a5737bc5295785f5c613a1", + "sha256:1fa6058938190ebe8290e5cae6c351e14e7bb44505c4a7624555ce57fbbeba0d", + "sha256:e982fe07ede9fada6ff6705af70514a52beb1b2c3d25d4e873e82114cf3c5401", + "sha256:5e5851969aea17660e55f6a3be00037a25b96a9b44d2083651812c99d53b14d1", + "sha256:f137c02498f8b935892d5c0172560d7ab54bc45039de8805075e19079c639a9c", + "sha256:3e835d8841ae7863f64e40e19477f7eb398674da6a47f09871673742531e6f4b", + "sha256:5edfa27b2d3eefa2210fb2f5d539fbed81722b49f083b2c6566455eb7422fd7e", + "sha256:857eebb2c1dc60e4219ec8e98dfa19553dae33608237e107db9c6078b1167856", + "sha256:bf54103892a83c64db58125b3f2a43df6d2cb2d28889f14c78519394feb41492", + "sha256:048ef924c1623740e70204aa7143ec592504045ae4429b59c30054cb31e3c432", + "sha256:83381342bfc22b3c8c06f2dd93a505413888694302de25add756254beee8449c", + "sha256:130f844e7f5bdd8e9f3f42e7102ef1d49b2e6fdf0d7526df3f87281a532d8c8b", + "sha256:52b07fbc32032c21ad4ab060fec137b76eb804c4b9a1c7c7dc562549306afad2", + "sha256:1f19ef5d3908110e1e891deefb5586aae1b49a7440db952454b4e281b41620cd", + "sha256:1b8a7a87ad1b92bd887568ce54b23565f3fd7018c4180136e1cf412b405a47af", + "sha256:d9ac82be533394d341b41d78aca7ed0e0f4ba5a2231602e2f05aa87f25c51672", + "sha256:1c25694ca680b6919de53a4bb3bdd0602beafc63ff001fea2f2fc16ec3a11834", + "sha256:7d263e5770efddf465a9e31b78362d84d015cc894ca2c131901a4445eaa61ee1", + "sha256:4e97332c9ce444b0c2c38dd22ddc61c743eb208d916e4265a2a3b575bdccb1d3" + ], + "version": "==1.1.0" + } + }, + "develop": {} +} diff --git a/install b/install index b2b6e57..a6d10dd 100755 --- a/install +++ b/install @@ -1,13 +1,4 @@ #!/bin/sh -dotfiles_dir="${DOTFILES:-$(dirname "$(realpath "$0")")}" -hostname="${HOSTNAME:-$(hostname)}" - -customs=$( - for i in $@ - do - echo "${dotfiles_dir}/${i}/" - done -) - -rsync -lr ${customs} "${dotfiles_dir}/${hostname}/" "${dotfiles_dir}/common/" "${HOME}" +cd $(dirname "$0") +pipenv run -- ./install.py "$@" diff --git a/install.py b/install.py new file mode 100755 index 0000000..e9b0159 --- /dev/null +++ b/install.py @@ -0,0 +1,35 @@ +#!/usr/bin/env python3 + +import argparse +import os +import sys +from pathlib import Path + +from mako.lookup import TemplateLookup + +def main(): + parser = argparse.ArgumentParser( + description='Generates and installs dotfiles for this host.', + formatter_class=argparse.ArgumentDefaultsHelpFormatter, + ) + parser.add_argument( + '-d', '--dotfiles', + help='The base directory of the dotfiles repository.', + type=Path, + default=Path(sys.argv[0]).parent, + ) + parser.add_argument( + '-n', '--hostname', + help='The hostname or other identifying name of this system.', + default=os.environ.get('HOSTNAME'), + ) + parser.add_argument( + '-o', '--home', + help='The home directory where generated dotfiles will be installed.', + default=os.environ.get('HOME') or Path.home(), + ) + args = parser.parse_args() + + + +main()