mirror of
https://github.com/ChrisTitusTech/linutil.git
synced 2024-11-05 21:28:48 +00:00
Merge branch 'main' into main
This commit is contained in:
commit
46a9d57d71
5
.github/PULL_REQUEST_TEMPLATE.md
vendored
5
.github/PULL_REQUEST_TEMPLATE.md
vendored
|
@ -1,8 +1,3 @@
|
|||
# Pull Request
|
||||
|
||||
## Title
|
||||
<!--[Provide a succinct and descriptive title for the pull request.]-->
|
||||
|
||||
## Type of Change
|
||||
- [ ] New feature
|
||||
- [ ] Bug fix
|
||||
|
|
26
.github/workflows/pr-labels.yaml
vendored
26
.github/workflows/pr-labels.yaml
vendored
|
@ -1,7 +1,7 @@
|
|||
name: Manage labels based on PR body
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
pull_request_target:
|
||||
types: [opened, edited, reopened, synchronize]
|
||||
|
||||
jobs:
|
||||
|
@ -9,8 +9,9 @@ jobs:
|
|||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Analyze PR Body and manage labels
|
||||
shell: bash
|
||||
run: |
|
||||
body="${{ github.event.pull_request.body }}"
|
||||
body=$(jq -r '.pull_request.body' "$GITHUB_EVENT_PATH")
|
||||
labels_to_add=()
|
||||
labels_to_remove=()
|
||||
declare -A label_checks=(
|
||||
|
@ -20,19 +21,23 @@ jobs:
|
|||
["Refactoring"]="refactor"
|
||||
["UI/UX improvement"]="UI/UX"
|
||||
)
|
||||
for key in "${!label_checks[@]}"; do
|
||||
if echo "$body" | grep -q "\- \[x\] $key"; then
|
||||
labels_to_add+=("${label_checks[$key]}")
|
||||
for pattern in "${!label_checks[@]}"; do
|
||||
label="${label_checks[$pattern]}"
|
||||
if echo "$body" | grep -Eq "\- \[x\] ($pattern)"; then
|
||||
labels_to_add+=("$label")
|
||||
else
|
||||
labels_to_remove+=("${label_checks[$key]}")
|
||||
labels_to_remove+=("$label")
|
||||
fi
|
||||
done
|
||||
echo "LABELS_TO_ADD=${labels_to_add[*]}" >> $GITHUB_ENV
|
||||
echo "LABELS_TO_REMOVE=${labels_to_remove[*]}" >> $GITHUB_ENV
|
||||
|
||||
echo "LABELS_TO_ADD=$(IFS=,; echo "${labels_to_add[*]}")" >> $GITHUB_ENV
|
||||
echo "LABELS_TO_REMOVE=$(IFS=,; echo "${labels_to_remove[*]}")" >> $GITHUB_ENV
|
||||
|
||||
- name: Add labels if necessary
|
||||
if: env.LABELS_TO_ADD != ''
|
||||
run: |
|
||||
for label in ${{ env.LABELS_TO_ADD }}; do
|
||||
IFS=',' read -ra labels <<< "${LABELS_TO_ADD}"
|
||||
for label in "${labels[@]}"; do
|
||||
curl -s -X POST \
|
||||
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
|
||||
-H "Accept: application/vnd.github.v3+json" \
|
||||
|
@ -42,7 +47,8 @@ jobs:
|
|||
- name: Remove labels if necessary
|
||||
if: env.LABELS_TO_REMOVE != ''
|
||||
run: |
|
||||
for label in ${{ env.LABELS_TO_REMOVE }}; do
|
||||
IFS=',' read -ra labels <<< "${LABELS_TO_REMOVE}"
|
||||
for label in "${labels[@]}"; do
|
||||
curl -s -X DELETE \
|
||||
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
|
||||
-H "Accept: application/vnd.github.v3+json" \
|
||||
|
|
|
@ -143,27 +143,30 @@ clone_config_folders() {
|
|||
}
|
||||
|
||||
configure_backgrounds() {
|
||||
# Set the variable PIC_DIR which stores the path for images
|
||||
PIC_DIR="$HOME/Pictures"
|
||||
|
||||
# Set the variable BG_DIR to the path where backgrounds will be stored
|
||||
BG_DIR="$HOME/Pictures/backgrounds"
|
||||
BG_DIR="$PIC_DIR/backgrounds"
|
||||
|
||||
# Check if the ~/Pictures directory exists
|
||||
if [ ! -d "~/Pictures" ]; then
|
||||
if [ ! -d "$PIC_DIR" ]; then
|
||||
# If it doesn't exist, print an error message and return with a status of 1 (indicating failure)
|
||||
echo "Pictures directory does not exist"
|
||||
mkdir ~/Pictures
|
||||
mkdir "$PIC_DIR"
|
||||
echo "Directory was created in Home folder"
|
||||
fi
|
||||
|
||||
# Check if the backgrounds directory (BG_DIR) exists
|
||||
if [ ! -d "$BG_DIR" ]; then
|
||||
# If the backgrounds directory doesn't exist, attempt to clone a repository containing backgrounds
|
||||
if ! git clone https://github.com/ChrisTitusTech/nord-background.git ~/Pictures; then
|
||||
if ! git clone https://github.com/ChrisTitusTech/nord-background.git "$PIC_DIR/nord-background"; then
|
||||
# If the git clone command fails, print an error message and return with a status of 1
|
||||
echo "Failed to clone the repository"
|
||||
return 1
|
||||
fi
|
||||
# Rename the cloned directory to 'backgrounds'
|
||||
mv ~/Pictures/nord-background ~/Pictures/backgrounds
|
||||
mv "$PIC_DIR/nord-background" "$PIC_DIR/backgrounds"
|
||||
# Print a success message indicating that the backgrounds have been downloaded
|
||||
echo "Downloaded desktop backgrounds to $BG_DIR"
|
||||
else
|
||||
|
@ -261,9 +264,6 @@ setupDisplayManager() {
|
|||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
install_slstatus() {
|
||||
|
|
87
tabs/system-setup/6-docker-setup.sh
Executable file
87
tabs/system-setup/6-docker-setup.sh
Executable file
|
@ -0,0 +1,87 @@
|
|||
#!/bin/sh -e
|
||||
|
||||
. ../common-script.sh
|
||||
|
||||
# Function to prompt the user for installation choice
|
||||
choose_installation() {
|
||||
clear
|
||||
printf "%b\n" "${YELLOW}Choose what to install:${RC}"
|
||||
printf "%b\n" "1. ${YELLOW}Docker${RC}"
|
||||
printf "%b\n" "2. ${YELLOW}Docker Compose${RC}"
|
||||
printf "%b\n" "3. ${YELLOW}Both${RC}"
|
||||
read -p "Enter your choice [1-3]: " CHOICE
|
||||
|
||||
case "$CHOICE" in
|
||||
1) INSTALL_DOCKER=1; INSTALL_COMPOSE=0 ;;
|
||||
2) INSTALL_DOCKER=0; INSTALL_COMPOSE=1 ;;
|
||||
3) INSTALL_DOCKER=1; INSTALL_COMPOSE=1 ;;
|
||||
*) echo "Invalid choice. Exiting."; exit 1 ;;
|
||||
esac
|
||||
}
|
||||
|
||||
install_docker() {
|
||||
printf "%b\n" "${YELLOW}Installing Docker...${RC}"
|
||||
case $PACKAGER in
|
||||
apt-get | yum)
|
||||
curl -fsSL https://get.docker.com | sh
|
||||
;;
|
||||
zypper)
|
||||
$ESCALATION_TOOL ${PACKAGER} --non-interactive install docker
|
||||
$ESCALATION_TOOL systemctl enable docker
|
||||
$ESCALATION_TOOL systemctl start docker
|
||||
;;
|
||||
pacman)
|
||||
$ESCALATION_TOOL ${PACKAGER} -S --noconfirm docker
|
||||
$ESCALATION_TOOL systemctl enable docker
|
||||
$ESCALATION_TOOL systemctl start docker
|
||||
;;
|
||||
*)
|
||||
printf "${RED}Unsupported package manager. Please install Docker manually.${RC}\n"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
install_docker_compose() {
|
||||
printf "%b\n" "${YELLOW}Installing Docker Compose...${RC}"
|
||||
case $PACKAGER in
|
||||
apt-get | yum)
|
||||
$ESCALATION_TOOL ${PACKAGER} update
|
||||
$ESCALATION_TOOL ${PACKAGER} install -y docker-compose-plugin
|
||||
;;
|
||||
zypper)
|
||||
$ESCALATION_TOOL ${PACKAGER} --non-interactive install docker-compose
|
||||
;;
|
||||
pacman)
|
||||
$ESCALATION_TOOL ${PACKAGER} -S --noconfirm docker-compose
|
||||
;;
|
||||
*)
|
||||
printf "${RED}Unsupported package manager. Please install Docker Compose manually.${RC}\n"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
install_components() {
|
||||
choose_installation
|
||||
|
||||
if [ "$INSTALL_DOCKER" -eq 1 ]; then
|
||||
if ! command_exists docker; then
|
||||
install_docker
|
||||
else
|
||||
printf "%b\n" "${GREEN}Docker is already installed.${RC}"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$INSTALL_COMPOSE" -eq 1 ]; then
|
||||
if ! command_exists docker-compose || ! command_exists docker compose version; then
|
||||
install_docker_compose
|
||||
else
|
||||
printf "%b\n" "${GREEN}Docker Compose is already installed.${RC}"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
checkEnv
|
||||
checkEscalationTool
|
||||
install_components
|
|
@ -55,3 +55,7 @@ script = "4-remove-snaps.sh"
|
|||
[[data]]
|
||||
name = "SSH-Samba Setup"
|
||||
script = "5-samba-ssh-setup.sh"
|
||||
|
||||
[[data]]
|
||||
name = "Docker Setup"
|
||||
script = "6-docker-setup.sh"
|
Loading…
Reference in New Issue
Block a user