-
Notifications
You must be signed in to change notification settings - Fork 167
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding exemples #41
Open
0x07CB
wants to merge
9
commits into
garywill:dev-12
Choose a base branch
from
Sanchez-Industries:master
base: dev-12
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Adding exemples #41
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
c2da432
typo
garywill e8284c5
add "Install" section in readme
garywill 433b3b8
add --dns-nocache option
garywill 9e1d985
move 'qrencode' from readme dependency to cli usage note
garywill 0061d4f
first update
0x07CB ceae3af
first update
0x07CB 38d8608
Update lnxrouter-wifi2eth.service
0x07CB d74b471
update : creation of an first install.sh script
a09a253
update of the install.sh script to fix errors
0x07CB File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
[Unit] | ||
Description=Linux Router (WiFi 2 Ethernet) | ||
After=network.target | ||
StartLimitIntervalSec=0 | ||
|
||
[Service] | ||
Type=simple | ||
Restart=always | ||
RestartSec=5 | ||
User=root | ||
ExecStart=/usr/bin/lnxrouter -i eth0 -o wlan0 --random-mac | ||
|
||
[Install] | ||
WantedBy=multi-user.target |
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,113 @@ | ||
#!/bin/bash | ||
# This script will install the dependencies for the project | ||
# Author: Rick Sanchez | ||
# Date: 2/9/2022 | ||
|
||
linux_install_with_package_manager() { | ||
# if the OS is debian/ubuntu use apt-get to install $1 | ||
if [ -f /etc/debian_version ]; then | ||
sudo apt-get install -y $1 | ||
# elif the OS is archlinux use pacman to install $1 | ||
elif [ -f /etc/arch-release ]; then | ||
sudo pacman -S --noconfirm $1 | ||
# elif the OS is redhat/fedora use yum to install $1 | ||
elif [ -f /etc/redhat-release ]; then | ||
sudo yum install -y $1 | ||
else | ||
echo "OS not supported" | ||
exit 1 | ||
fi | ||
} | ||
|
||
linux_update_package_manager(){ | ||
if [ -f /etc/debian_version ]; then | ||
sudo apt-get update | ||
elif [ -f /etc/arch-release ]; then | ||
sudo pacman -Syu | ||
elif [ -f /etc/redhat-release ]; then | ||
sudo yum update | ||
else | ||
echo "OS not supported" | ||
exit 1 | ||
fi | ||
} | ||
|
||
# update the packager appropriately for the OS and architecture | ||
if [ "$(uname)" == "Darwin" ]; then | ||
export PACKAGER="macosx" | ||
elif [ "$(expr substr $(uname -s) 1 5)" == "Linux" ]; then | ||
export PACKAGER="linux" | ||
fi | ||
|
||
# update the architecture appropriately for the OS and architecture | ||
if [ "$(uname -m)" == "x86_64" ]; then | ||
export ARCH="amd64" | ||
elif [ "$(uname -m)" == "i686" ]; then | ||
export ARCH="386" | ||
fi | ||
|
||
# if the var $PACKAGER is not set, exit with an error | ||
if [ -z "$PACKAGER" ]; then | ||
echo "Unable to determine the packager for this OS and architecture." | ||
exit 1 | ||
else | ||
# else call the appropriate package manager to install | ||
if [[ "$PACKAGER" == "linux" ]]; then | ||
echo 'linux package manager update...' | ||
linux_update_package_manager | ||
echo 'linux package manager install...' | ||
linux_install_with_package_manager python3 | ||
elif [[ "$PACKAGER" == "macosx" ]]; then | ||
if [ -f /usr/local/bin/brew ]; then | ||
echo "Homebrew is already installed so brew update and brew upgrade" | ||
echo "Homebrew installation skipped." | ||
brew update | ||
brew install [email protected] pipenv | ||
else | ||
echo "Homebrew is not installed. Installation of homebrew..." | ||
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" | ||
echo "Now installing, brew update and install [email protected] and pipenv..." | ||
brew update | ||
brew install [email protected] pipenv | ||
fi | ||
fi | ||
fi | ||
|
||
# function to install packages with the appropriate package manager, linux, mac, fedora, etc. | ||
function install_packages() { | ||
if [ "$(uname)" == "Darwin" ]; then | ||
brew install $1 | ||
elif [ "$(expr substr $(uname -s) 1 5)" == "Linux" ]; then | ||
#detect linux branch based | ||
linux_install_with_package_manager $1 | ||
elif [ "$(expr substr $(uname -s) 1 10)" == "MINGW32_NT" ]; then | ||
echo "Windows" | ||
else | ||
echo "Unknown OS" | ||
fi | ||
} | ||
|
||
# install the packages | ||
install_packages hostapd | ||
install_packages haveged | ||
install_packages dnsmasq | ||
install_packages qrencode | ||
|
||
# make the /opt/lnxrouter directory | ||
sudo mkdir -p /opt/lnxrouter | ||
|
||
# make the /opt/lnxrouter/bin directory | ||
sudo mkdir -p /opt/lnxrouter/bin | ||
|
||
# copy the lnxrouter script to /opt/lnxrouter/bin | ||
sudo cp lnxrouter /opt/lnxrouter/bin/lnxrouter | ||
|
||
# change the permissions on the lnxrouter script | ||
sudo chown -R $USER:$USER /opt/lnxrouter/ | ||
sudo chmod a+x /opt/lnxrouter/bin/lnxrouter | ||
|
||
# create symbolic link to the lnxrouter.sh script | ||
sudo ln -s /opt/lnxrouter/bin/lnxrouter /usr/bin/lnxrouter | ||
|
||
# display "It's done!" in yellow | ||
echo -e "\e[33mIt's done!\e[0m" |
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could be just one command: sudo mkdir -p /opt/lnxrouter/bin
This would create both the /opt/lnxrouter and /opt/lnxrouter/bin directories at the same time.