-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #117 from entelecheia/main
- Loading branch information
Showing
10 changed files
with
148 additions
and
7 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
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
DOTFILES_VERSION: 0.37.2 | ||
DOTFILES_VERSION: 0.37.3 | ||
packages: | ||
- name: 1password-cli | ||
apt: true | ||
|
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,57 @@ | ||
#!/bin/bash | ||
|
||
# Function to create user and set password | ||
create_user() { | ||
local username=$1 | ||
local password=$2 | ||
|
||
sudo useradd -m -s /bin/bash "$username" | ||
echo "$username:$password" | sudo chpasswd | ||
} | ||
|
||
# Function to add user to groups | ||
add_user_to_groups() { | ||
local username=$1 | ||
shift | ||
local groups=("$@") | ||
|
||
for group in "${groups[@]}"; do | ||
sudo usermod -aG "$group" "$username" | ||
done | ||
} | ||
|
||
# Function to create data directory and symlink | ||
create_data_directory() { | ||
local username=$1 | ||
local data_root=$2 | ||
|
||
local data_directory="$data_root/$username" | ||
sudo mkdir -p "$data_directory" | ||
sudo chown "$username:$username" "$data_directory" | ||
|
||
local home_directory="/home/$username" | ||
ln -s "$data_directory" "$home_directory/data" | ||
} | ||
|
||
# Main script | ||
if [[ $EUID -ne 0 ]]; then | ||
echo "This script must be run as root or with sudo." | ||
exit 1 | ||
fi | ||
|
||
read -rp "Enter the username: " username | ||
read -s -rp "Enter the password: " password | ||
echo | ||
read -rp "Enter the groups (separated by space): " -a groups | ||
read -rp "Enter the root directory for data (e.g., /raid/data): " data_root | ||
|
||
echo "Creating user $username..." | ||
create_user "$username" "$password" | ||
|
||
echo "Adding user $username to groups: ${groups[*]}" | ||
add_user_to_groups "$username" "${groups[@]}" | ||
|
||
echo "Creating data directory and symlink for user $username..." | ||
create_data_directory "$username" "$data_root" | ||
|
||
echo "User $username created successfully." |
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,54 @@ | ||
#!/bin/bash | ||
|
||
# Function to install Python dependencies | ||
install_dependencies() { | ||
sudo apt update | ||
sudo apt install -y build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev \ | ||
libssl-dev libreadline-dev libffi-dev wget | ||
} | ||
|
||
# Function to download and install Python | ||
install_python() { | ||
local python_version=$1 | ||
local python_url="https://www.python.org/ftp/python/${python_version}/Python-${python_version}.tgz" | ||
|
||
wget "$python_url" | ||
tar -xf "Python-${python_version}.tgz" | ||
cd "Python-${python_version}" || exit | ||
|
||
./configure --enable-optimizations | ||
make -j "$(nproc)" | ||
sudo make altinstall | ||
|
||
cd .. | ||
rm -rf "Python-${python_version}" "Python-${python_version}.tgz" | ||
} | ||
|
||
# Function to update alternatives for Python | ||
update_alternatives() { | ||
local python_version=$1 | ||
local python_priority=$2 | ||
|
||
sudo update-alternatives --install /usr/bin/python python "/usr/local/bin/python${python_version%.*}" "$python_priority" | ||
sudo update-alternatives --install /usr/bin/pip pip "/usr/local/bin/pip${python_version%.*}" "$python_priority" | ||
} | ||
|
||
# Main script | ||
if [[ $EUID -ne 0 ]]; then | ||
echo "This script must be run as root or with sudo." | ||
exit 1 | ||
fi | ||
|
||
read -rp "Enter the Python version to install (e.g., 3.9.7): " python_version | ||
read -rp "Enter the priority for the Python version (e.g., 1): " python_priority | ||
|
||
echo "Installing Python dependencies..." | ||
install_dependencies | ||
|
||
echo "Installing Python $python_version..." | ||
install_python "$python_version" | ||
|
||
echo "Updating alternatives for Python..." | ||
update_alternatives "$python_version" "$python_priority" | ||
|
||
echo "Python $python_version installation completed." |
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,6 +1,6 @@ | ||
[tool.poetry] | ||
name = "dotfiles" | ||
version = "0.37.2" | ||
version = "0.37.3" | ||
description = "Easily manage and synchronize your dotfiles across multiple environments with the Dotfiles project, streamlining your development setup and CI/CD pipeline." | ||
authors = ["Young Joon Lee <[email protected]>"] | ||
license = "MIT" | ||
|