Movatterモバイル変換


[0]ホーム

URL:


homedir

This project contains an approach to maintain several systems with aminimum of fuss. To accomplish this, there are scripts to installsystem packages (if required), set up a home directory for a user, andinstall user-specific packages. Configurations for many programs areinstalled by default and some programs are handled specially.

This supports all UNIX and Windows platforms. Other platforms may ormay not work depending on their approach to user configuration andsupport for Python.

The home directory is intended to be tracked using git and sharedpublicly. It is intended to be used unchanged across multiplemachines and so should be designed to work well across different typesof systems that support Python and the various programs. Sensitiveinformation is provided for by including hooks to local files that areare not included in the shared repository.

rationale

Keeping the configuration of several systems consistent ischallenging. There are some high-level tools for doing so, but arecomplicated to set up. This intends to be a fairly straightforwardapproach to the problem.

overview

bootstrap

Bootstrapping a system involves making sure theadministrator useris present and satisfies the minimal requirements for an administratorof the system. It also ensures that required system packages areinstalled.

system

Installing system packages involves ensuring that the system is up todate and all required packages are installed.

user

supported systems

While theinstall portion of this system supports Cygwin- orMSYS-based systems, the package managers for those systems are notsupported.

requirements

The install family of scripts assumes that they are run from the rootof thetee3/homedir directory.

bootstrap

linux

macos

windows

system

linux

macos

windows

user

For installing user services, the following programs are required.

To configure some useful programs, those programs must exist on thesystem.

bootstrap

The process below assumes a system with a user namedadministratorthat may or may not yet havesudo privileges.

This is especially useful with a “minimal installation” Linux machinesince many packages are not installed by default.

fedora

From the login terminal of the system, log in asroot and theninstallsudo and giveadministratorsudo privileges.

login: rootpassword:************
yuminstall sudousermod administrator-a-G wheelexit

From the login terminal of the system, log in asadministrator andthen installgit, clone thetee3/homedir repository and installthe system packages. At the end of this process, the machine willreboot, so make sure there is no one else logged in.

login: administratorpassword:************
sudoyuminstallgitgit clone https://github.com/tee3/homedir.git ~/Development/homedircd ~/Development/homedir./install_bootstrap_packages_fedorasudoshutdown-r now

debian

From the login terminal of the system, log in asroot and theninstallsudo and giveadministratorsudo privileges.

login: rootpassword:************
apt-getinstall sudoadduser administratorsudoexit

From the login terminal of the system, log in asadministrator andthen installgit, clone thetee3/homedir repository and installthe system packages. At the end of this process, the machine willreboot, so make sure there is no one else logged in.

login: administratorpassword:************
sudoapt-getinstallgitgit clone https://github.com/tee3/homedir.git ~/Development/homedircd ~/Development/homedir./install_bootstrap_packages_debiansudoshutdown-r now

macos

Install Xcode and the Xcode Command-Line Tools, as well as Homebrew,while logged in to the graphical system asadministrator. From aTerminal.app window install the system packages. At the end of thisprocess, the machine will reboot, so make sure there is no one elselogged in.

git clone https://github.com/tee3/homedir.git ~/Development/homedircd ~/Development/homedir./install_bootstrap_packages_macossudoshutdown-r now

windows

Go to Settings->Update & Security->For developers->Developer Mode andenable it. Install “App Installer” from the Microsoft Store, and theWindows Package Manager CLI (winget-cli) fromhttps://github.com/microsoft/winget-cli.

From acmd window install the system packages. At the end of thisprocess, the machine will reboot, so make sure there is no one elselogged in.

wingetinstall--exact --idGit.Gitgitclonehttps://github.com/tee3/homedir.gitC:\Users\administrator\Development\homedircdC:\Users\administrator\Development\homedirinstall_bootstrap_packages_windowsshutdown/r

windows subsystem for linux

This is a Ubunutu-based command-line system within Windows 10Anniversary Edition. As such, it is supported as if it were a Debiansystem above.

  1. Enable theDeveloper Mode radio button inSettings->Update &security->For developers.

  2. Enable theWindows Subsystem for Linux inControlPanel->Programs->Turn Windows features on or off and follow theinstructions and reboot.

  3. Runbash within aCommand Prompt and agree to install Ubuntu.

  4. Enteradministrator when asked for a user.

  5. Exit theCommand Prompt.

  6. RunBash on Ubuntu for Windows from theStart Menu, whichwill log in asadministrator.

  7. Add a userUSER by running the following command.

    sudo /usr/sbin/adduser USER
  8. Exit theBash on Ubuntu for Windows shell.

From the login terminal of the system, log in asadministrator byrunningBash on Ubuntu for Windows and then installgit, clonethetee3/homedir repository and install the system packages.

sudoapt-getinstallgitgit clone https://github.com/tee3/homedir.git ~/Development/homedircd ~/Development/homedir./install_bootstrap_packages_debian

Note that Windows Subsystem for Linux is supported as it is aapt-get-based system. While this is a true Linux system, there arestill some limitations. It is based on Ubuntu (and an earlier versionof Debian), and so runs some older packages. It also seems as if theinit system is not run as expected.

The following provides somead-hoc workarounds for theselimitations.

  1. To switch to theadministrator user, run thelxrun command asshown below.

    lxrun/setdefaultuseradministrator
  2. To update the package databases, run thelxrun command as shownbelow.

    lxrun/update

system

Installing system packages should be done as necessary as it updatesthe system as well as installs system packages added after the initialbootstrap of the system.

NOTE: Installing system packages should really be generalized a bitsince packages required for work are the same regardless of whichsystem you are on. A package list with a script for each system thatprocesses the list and turns it into commands to Homebrew,apt-get,yum, etc. would be an interesting approach.

The system install scripts are written in the least-common denominatorlanguage for the system on which it runs.

fedora

To install system packages for Fedora-based systems (viayum), runthe following script as a user withsudo permission.

./install_system_packages_fedora

debian

To install system packages for Debian-based systems (viaapt-get),run the following script as a user withsudo permission.

./install_system_packages_debian

macos

To install system packages for macOS (via Homebrew), run the followingscript as the administrator of the system. Note that this does notusesudo as Homebrew does not require it.

./install_system_packages_macos

windows

To install system packages for Windows, run the following script asthe administrator of the system.

install_system_packages_windows

user

To set up a new system or update an existing system for a user, runthe following commands when logged in as that user. Note that allsystem packages should be installed prior to theinstall script viathe bootstrap procedure above so all support applications are properlyset up.

Theinstall script checks for the requirements and then helps theuser set up a home directory. There is special support for featuresthat require it. It is not recommended to install the~/opt/localdirectories or the scripting language tools for theadministratoruser.

Note that theinstall script and its supported scripts requirePython.

python3install

Support for sensitive information

Each supported feature provideslocal,machine, oruser-specificfiles for configuration local to a particular machine or user that isnot appropriate to put on a public server. This includes things likenames, email addresses, keys, certificates, and other sensitiveinformation.

support forsh

This contains support for the Bourne Shell (sh) via the~/.profilefile.

The configuration system generates a~/.profile.local file for localconfiguration. It is initially empty.

support forbash

This contains support for the Bourne Again Shell (Bash) by including~/.bash_profile,~/.bashrc,~/.bash_logout, and~/.bashrc.local files. This builds off the Bourne Shell support.

The configuration system generates a~/.bashrc.local file for localconfiguration. It is initially empty.

support forzsh

This contains support for the Z Shell (bash) by including~/.zprofile and~/.zshrc files. This builds off the Bourne Shellsupport.

The configuration system generates a~/.zshrc.local file for localconfiguration. It is initially empty.

support forcmd

This contains some minimal support forcmd such that HOME is setproperly and development tools are properly set up. This models howbash is initialized by adding a~/.cmdrc.bat file (and~/.cmdrc.local.bat file) that is executed on startingcmd.

The configuration system generates a~/.cmdrc.local.bat file forlocal configuration. It is initially empty.

support for emacs

This contains a~/.emacs file, which installs and configures Emacspackages automatically viause-package andpackage.

The configuration system generates~/.emacs.machine.el and~/.emacs.user.el for local machine and user configuration. Thesefiles initially contain only boilerplate for Emacs Lisp file. Theconfiguration system optionally will provide the user with suggestionsto set up these files to properly set the system’s name and the user’sname and email address since these are often detected incorrectly byEmacs.

There is a also a very minimal Emacs configuration file named~/.emacs.minimal.el. This can beinstalled to~/.emacs manually on systems that do not require a fullhomedir installation.

It can also be used to experiment with a minimally-configured Emacs.Run the following command to use Emacs with the minimal Emacsconfiguration.

emacs-nw-q-l ~/.emacs.minimal.el

This is not exactly the same as running Emacs with~/.emacs, but itis close enough for experimentation.

support for ssh

This includes~/.ssh/config file to configure SSH. This is intendedto be portable across all systems including Windows.

The~/.ssh/config file includes all files in the directory~/.ssh/config.d. This is intended for configuration parameters thatare sensitive and should not be shared on a public server.

The user is required to move the current contents of~/.ssh/configbefore migrating to this approach since it is a fairly complicatedprocess. One approach is to move the existing~/.ssh/config file toa file in~/.ssh/config.d. This will override all settings in theshared~/.ssh/config file.

support for git

This includes~/.gitconfig,~/.gitignore, and~/.gitattributesfiles to configure Git. This is intended to be portable across allsystems including Windows.

The~/.gitconfig file includes files named~/.gitconfig.machineand~/.gitconfig.user for machine-specific and user-specificconfiguration parameters. This is intended for configurationparameters that are sensitive and should not be shared on a publicserver.

The install script will migrate the user name/email from~/.gitconfig to~/.gitconfig.user as required.

support for~/opt/local

Theinstall script will build a directory structure at~/opt/localif it does not exist.

This is populated with source packages described below.

support for python packages

Python packages are installed using the user protocol and arequirements file defines the installed Python packages.

Seeinstall_python_packages.txt for alist of installed Python packages.

support for ruby packages

Ruby gems are installed using the user protocol and a Gemfile definesthe installed Ruby packages.

Seeinstall_ruby_packages.gemfilefor a list of installed Ruby packages.

support for rust packages

Rust programs are using installed for the local user, which is thedefault.

Seeinstall_rust_packages.txt for alist of installed Rust packages.

support for node.js packages

Node.js modules are installed to the user’s home directory under~/.node_modules and a text file defines the installed Node.jsmodules.

See theinstall_node_packages.txt for alist of installed Node.js packages.

Note that this might be done more cleanly by using apackage.jsonfile and thenpm install machinery for it directly instead of a textfile ofnpm package names. Unfortunately, I have not figured outhow to do this yet.

support for go packages

Go packages are installed to the user’s home directory under~/.goand a text file defines the installed Go packages.

See theinstall_go_packages.txt for alist of installed Go packages.

support for source packages

There is a script to support installing packages that are notsupported by a standard package manager or require specialconsideration.

See the bottom of thescript for an moreup-to-date list of source packages.

support for boost versions

There is a script to install any version of Boost C++ Libraries into adirectory in the~/opt/local/src/boost directory.

See thescript for the details.


[8]ページ先頭

©2009-2025 Movatter.jp