-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
778 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2021 Anurag Roy | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# user_files | ||
|
||
Contains some (mainly dotfiles) files to be deployed on a fresh linux system. | ||
|
||
Intended to go along with [manjaro_init](https://github.com/RoyARG02/manjaro-init). | ||
|
||
The files to be deployed are present in `files` folder. | ||
|
||
The name of the files, alongwith the location to be deployed (_read copied_) to and the new name are maintained in `deploy_files.txt`. Additional comments are mentioned in that file about its usage. | ||
|
||
The **POSIX** compliant main script, `deploy_user_files.sh`, reads the file list from `deploy_files.txt`, and copies them according to the instructions. | ||
Executing the default instructions **will require superuser privileges**. | ||
|
||
## Usage | ||
|
||
1. Clone the repository. | ||
2. Run `chmod +x deploy_user_files.sh`. | ||
3. Run `sudo ./deploy_user_files.sh`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,40 @@ | ||
### The list of files and the locations they should be | ||
### copied to. | ||
### The list of files and the locations they should be copied to. | ||
### | ||
### The files are listed in this order: | ||
### Each line below specifies the files to be copied by this order: | ||
### | ||
### <name of the file in this folder> <name to be copied as> <location to be copied to> | ||
### <name of the file in "./files" folder> <name to be copied as> <location to be copied to> | ||
### | ||
### For instance, ".bashrc" for the root user is defined below as: | ||
### | ||
### <.rootbashrc> <.bashrc> </root> | ||
### .rootbashrc .bashrc /root | ||
### | ||
### "Name to be copied as" can be omitted. In that case, | ||
### the name of the file in this folder is used. See the | ||
### line to copy ".bashrc" file for an example. | ||
### "Name to be copied as" can be omitted. In that case, the same name of the | ||
### file as it is named in the "./files" folder is used. See the line to copy | ||
### ".bashrc" file for an example. | ||
### | ||
### Multiple locations can be defined for the file to be | ||
### copied to multiple locations with the same name. If | ||
### different file names are required, define them in | ||
### separate lines. | ||
### If any file is to be copied to multiple locations, name them one after the | ||
### other at the end of the line. The file will be copied to those locations | ||
### having the SAME name, so if different file names are desired, specify them | ||
### in different lines. | ||
### | ||
### It's preferable to define the location of the file as | ||
### an absolute path. | ||
### It is preferable to define the location of the file as an absolute path, | ||
### but "~" can be used to represent the user home directory. | ||
### | ||
### Copying any file in this list can be skipped by | ||
### appending a '#' in front of the line, or by deleting | ||
### them altogether. | ||
### Copying any file in this list can be skipped by appending a '#' in front of | ||
### the line, or by deleting them altogether. | ||
|
||
.bashrc ~/ | ||
.bashrc ~ | ||
.rootbashrc .bashrc /root | ||
.profile ~/ | ||
.vimrc ~/ /root | ||
.rootprofile .profile /root | ||
.profile ~ | ||
.vimrc ~ /root | ||
.xinitrc ~ /root | ||
.xprofile ~ /root | ||
motd.sh /etc/profile.d | ||
tlp.conf /etc | ||
pacman.conf /etc | ||
fstab /etc | ||
inputrc /etc | ||
optimus-manager.conf /etc/optimus-manager | ||
nobeep.conf /etc/modprobe.d | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,47 @@ | ||
#!/usr/bin/sh | ||
|
||
### Copies a list of files, from `deploy_files.txt`, to their | ||
### appropriate locations. | ||
### Copies a list of files, from `deploy_files.txt`, to their appropriate | ||
### locations. | ||
### | ||
### See `deploy_files.txt` to see what files are being copied. | ||
### | ||
### Requires root permissions to function properly. | ||
|
||
[ $(id -u) -ne 0 ] && \ | ||
### The location of the user home directory. | ||
### | ||
### This is used to substitute the "~" character in the locations specified in | ||
### "deploy_files.txt" | ||
USER_HOME="/home/anurag" | ||
|
||
[ "$(id -u)" -ne 0 ] && \ | ||
echo "[ERROR] Copying user files needs root privileges to function properly" && exit 1 | ||
|
||
[ -r ./deploy_files.txt ] || \ | ||
echo "[ERROR] Could not find "deploy_files.txt". Are you sure it exists?" && exit 1 | ||
## Check if 'deploy_files.txt' exists and is readable | ||
[ ! -r ./deploy_files.txt ] && \ | ||
echo "[ERROR] Could not find \"deploy_files.txt\". Are you sure it exists?" && exit 1 | ||
|
||
## Read list of files. | ||
|
||
## If the file mentioned at the 2nd field exists and is a directory, assume | ||
## that as a location. | ||
|
||
### Since the script is run with elevated privileges, "~" will refer to "/root" | ||
### instead of the user's home directory. The "sub" function of awk replaces | ||
### the "~" character and with USER_HOME. | ||
awk -v home=$USER_HOME ' | ||
! /^#.*$|^$/ { | ||
copy_from=3; | ||
copy_as=""; | ||
if(system("test -d "$2) == 0) { | ||
copy_from=2; | ||
} else { | ||
copy_as=$2; | ||
} | ||
for( i=copy_from ; i <= NF ; ++i ){ | ||
sub(/^~/, home, $i); | ||
system("cp -iv ./files/"$1" "$i"/"copy_as); | ||
} | ||
}' deploy_files.txt | ||
|
||
## Read list of files | ||
## TODO | ||
unset USER_HOME | ||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# /etc/fstab: static file system information. | ||
# | ||
# Use 'blkid' to print the universally unique identifier for a device; this may | ||
# be used with UUID= as a more robust way to name devices that works even if | ||
# disks are added and removed. See fstab(5). | ||
# | ||
# <file system> <mount point> <type> <options> <dump> <pass> | ||
UUID=33FD-E4AE /boot/efi vfat umask=0077 0 2 | ||
UUID=f70f70ea-d78b-40b8-9cf5-d3490c2218d0 / ext4 defaults,noatime 0 1 | ||
UUID=44065268-860e-4a75-8efa-41e833b34d32 /home ext4 defaults,noatime 0 2 | ||
UUID=3de38af1-fc89-4336-865b-c1340800f373 none swap defaults 0 0 | ||
tmpfs /tmp tmpfs defaults,noatime,mode=1777 0 0 | ||
UUID=1893BD5B741FC612 /mnt/D ntfs defaults 0 0 | ||
UUID=4888CDE031BF1FFA /mnt/E ntfs defaults 0 0 | ||
UUID=49D007D2239C4886 /mnt/F ntfs defaults 0 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# do not bell on tab-completion | ||
#set bell-style none | ||
|
||
set meta-flag on | ||
set input-meta on | ||
set convert-meta off | ||
set output-meta on | ||
set completion-ignore-case on | ||
|
||
$if mode=emacs | ||
|
||
# for linux console and RH/Debian xterm | ||
"\e[1~": beginning-of-line | ||
"\e[4~": end-of-line | ||
"\e[5~": beginning-of-history | ||
"\e[6~": end-of-history | ||
"\e[7~": beginning-of-line | ||
"\e[3~": delete-char | ||
"\e[2~": quoted-insert | ||
"\e[5C": forward-word | ||
"\e[5D": backward-word | ||
"\e\e[C": forward-word | ||
"\e\e[D": backward-word | ||
"\e[1;5C": forward-word | ||
"\e[1;5D": backward-word | ||
|
||
# for rxvt | ||
"\e[8~": end-of-line | ||
|
||
# for non RH/Debian xterm, can't hurt for RH/DEbian xterm | ||
"\eOH": beginning-of-line | ||
"\eOF": end-of-line | ||
|
||
# for freebsd console | ||
"\e[H": beginning-of-line | ||
"\e[F": end-of-line | ||
$endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/usr/bin/env bash | ||
|
||
curr_batt_percent=$(< /sys/class/power_supply/BAT0/capacity) | ||
echo "The current battery charge is at $curr_batt_percent%." | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Do not load the 'pcspkr' module on boot. | ||
blacklist pcspkr | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
[intel] | ||
DRI=3 | ||
accel= | ||
driver=modesetting | ||
modeset=yes | ||
tearfree= | ||
|
||
[nvidia] | ||
DPI=96 | ||
PAT=yes | ||
allow_external_gpus=no | ||
ignore_abi=no | ||
modeset=yes | ||
options=overclocking | ||
|
||
[optimus] | ||
auto_logout=no | ||
pci_power_control=yes | ||
pci_remove=no | ||
pci_reset=no | ||
startup_auto_battery_mode=intel | ||
startup_auto_extpower_mode=nvidia | ||
startup_mode=intel | ||
switching=nouveau |
Oops, something went wrong.