Skip to content

Commit

Permalink
Updates
Browse files Browse the repository at this point in the history
  • Loading branch information
felipealfonsog committed Dec 19, 2024
1 parent 2fa041f commit a009826
Show file tree
Hide file tree
Showing 2 changed files with 82 additions and 14 deletions.
48 changes: 41 additions & 7 deletions installer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -115,41 +115,73 @@ install_dependencies_linux() {
fi
}


download_source_code() {
source_file_url="https://raw.githubusercontent.com/felipealfonsog/GitSyncMaster/refs/heads/main/src/src-std/gitsync.py"
source_file_name="gitsync.py"
if [[ $(uname) == "Darwin" ]]; then
source_file_url="https://raw.githubusercontent.com/felipealfonsog/GitSyncMaster/main/src/src-std/gitsync.py" # Correct URL
source_file_name="gitsync.py"
elif [[ $(uname) == "Linux" ]]; then
source_file_url="https://raw.githubusercontent.com/felipealfonsog/GitSyncMaster/main/src/src-std/gitsync.py" # Correct URL
source_file_name="gitsync.py"
else
echo "Unsupported operating system. Please install manually, read documentation, and re-run the installer."
exit 1
fi

curl -o "$source_file_name" "$source_file_url"
}



move_exec_file() {
if [[ -f "$source_file_name" ]]; then
# Transform the source file into an executable
chmod +x "$source_file_name"

# Move the executable file to /usr/local/bin/
if [[ $(uname) == "Darwin" ]]; then
# Move the executable file to /usr/local/bin/
sudo cp "$source_file_name" /usr/local/bin/

# Assign execution permissions if gitsync doesn't exist in that location
if [[ ! -x /usr/local/bin/gitsync ]]; then
sudo chmod +x /usr/local/bin/gitsync
fi
else
# Copy the source file to /bin directory of each distribution
if [[ -f /etc/arch-release ]]; then
sudo cp "$source_file_name" /usr/bin/
elif [[ -f /etc/debian_version ]]; then
sudo cp "$source_file_name" /usr/local/bin/
else
sudo cp "$source_file_name" /usr/local/bin/
fi
fi

# Assign execution permissions if gitsync doesn't exist in that location
if [[ ! -x /usr/local/bin/gitsync ]]; then
sudo chmod +x /usr/local/bin/gitsync
# Move the executable file to the appropriate location
if [[ -f /etc/arch-release ]]; then
sudo mv "$source_file_name" /usr/bin/gitsync
elif [[ -f /etc/debian_version ]]; then
sudo mv "$source_file_name" /usr/local/bin/gitsync
else
sudo mv "$source_file_name" /usr/local/bin/gitsync
fi

# Assign execution permissions to the gitsync file if it already exists in any of those locations
if [[ -x /usr/bin/gitsync ]]; then
sudo chmod +x /usr/bin/gitsync
elif [[ -x /usr/local/bin/gitsync ]]; then
sudo chmod +x /usr/local/bin/gitsync
fi
fi
else
echo "Error: File $source_file_name not found."
exit 1
fi
}





configure_path() {
if [[ $(uname) == "Darwin" ]]; then
echo 'export PATH="/usr/local/bin:$PATH"' >> ~/.bash_profile
Expand Down Expand Up @@ -197,8 +229,10 @@ cleanup() {
rm "gitsync"
echo "Installer binary has been deleted."
fi

}


main() {
welcome
check_execute_permission
Expand Down
48 changes: 41 additions & 7 deletions installer_AppleSilicon.sh
Original file line number Diff line number Diff line change
Expand Up @@ -115,41 +115,73 @@ install_dependencies_linux() {
fi
}


download_source_code() {
source_file_url="https://raw.githubusercontent.com/felipealfonsog/GitSyncMaster/refs/heads/main/src/src-std/gitsync.py"
source_file_name="gitsync.py"
if [[ $(uname) == "Darwin" ]]; then
source_file_url="https://raw.githubusercontent.com/felipealfonsog/GitSyncMaster/main/src/src-std/gitsync.py" # Correct URL
source_file_name="gitsync.py"
elif [[ $(uname) == "Linux" ]]; then
source_file_url="https://raw.githubusercontent.com/felipealfonsog/GitSyncMaster/main/src/src-std/gitsync.py" # Correct URL
source_file_name="gitsync.py"
else
echo "Unsupported operating system. Please install manually, read documentation, and re-run the installer."
exit 1
fi

curl -o "$source_file_name" "$source_file_url"
}



move_exec_file() {
if [[ -f "$source_file_name" ]]; then
# Transform the source file into an executable
chmod +x "$source_file_name"

# Move the executable file to /usr/local/bin/
if [[ $(uname) == "Darwin" ]]; then
# Move the executable file to /usr/local/bin/
sudo cp "$source_file_name" /usr/local/bin/

# Assign execution permissions if gitsync doesn't exist in that location
if [[ ! -x /usr/local/bin/gitsync ]]; then
sudo chmod +x /usr/local/bin/gitsync
fi
else
# Copy the source file to /bin directory of each distribution
if [[ -f /etc/arch-release ]]; then
sudo cp "$source_file_name" /usr/bin/
elif [[ -f /etc/debian_version ]]; then
sudo cp "$source_file_name" /usr/local/bin/
else
sudo cp "$source_file_name" /usr/local/bin/
fi
fi

# Assign execution permissions if gitsync doesn't exist in that location
if [[ ! -x /usr/local/bin/gitsync ]]; then
sudo chmod +x /usr/local/bin/gitsync
# Move the executable file to the appropriate location
if [[ -f /etc/arch-release ]]; then
sudo mv "$source_file_name" /usr/bin/gitsync
elif [[ -f /etc/debian_version ]]; then
sudo mv "$source_file_name" /usr/local/bin/gitsync
else
sudo mv "$source_file_name" /usr/local/bin/gitsync
fi

# Assign execution permissions to the gitsync file if it already exists in any of those locations
if [[ -x /usr/bin/gitsync ]]; then
sudo chmod +x /usr/bin/gitsync
elif [[ -x /usr/local/bin/gitsync ]]; then
sudo chmod +x /usr/local/bin/gitsync
fi
fi
else
echo "Error: File $source_file_name not found."
exit 1
fi
}





configure_path() {
if [[ $(uname) == "Darwin" ]]; then
echo 'export PATH="/usr/local/bin:$PATH"' >> ~/.bash_profile
Expand Down Expand Up @@ -197,8 +229,10 @@ cleanup() {
rm "gitsync"
echo "Installer binary has been deleted."
fi

}


main() {
welcome
check_execute_permission
Expand Down

0 comments on commit a009826

Please sign in to comment.