mirror of
https://github.com/gryf/vmstrap.git
synced 2025-12-18 20:10:28 +01:00
Move out search for firts ip to the separate script.
This commit is contained in:
11
bootstrap.sh
11
bootstrap.sh
@@ -277,16 +277,6 @@ common_conf() {
|
|||||||
cp "${DIR}/.gitconfig" ~/
|
cp "${DIR}/.gitconfig" ~/
|
||||||
cp "${DIR}/cleanup.sh" ~/
|
cp "${DIR}/cleanup.sh" ~/
|
||||||
|
|
||||||
for i in $(seq 0 3); do
|
|
||||||
ifname=$(ip -j a|jq -r .[$i].ifname)
|
|
||||||
if [[ "${ifname}" = "lo" ]]; then
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
ipaddr=$(ip -j a|jq -r \
|
|
||||||
".[$i].addr_info[] | select(.family == \"inet\") | .local")
|
|
||||||
break;
|
|
||||||
done
|
|
||||||
|
|
||||||
{
|
{
|
||||||
echo 'source ~/.bash_prompt'
|
echo 'source ~/.bash_prompt'
|
||||||
echo "alias ipc='ip -c'"
|
echo "alias ipc='ip -c'"
|
||||||
@@ -299,7 +289,6 @@ common_conf() {
|
|||||||
echo "if which kubectl 2>/dev/null >/dev/null; then"
|
echo "if which kubectl 2>/dev/null >/dev/null; then"
|
||||||
echo " source <(kubectl completion bash)"
|
echo " source <(kubectl completion bash)"
|
||||||
echo "fi"
|
echo "fi"
|
||||||
echo "export HOST_IP=${ipaddr}"
|
|
||||||
} >> ~/.bashrc
|
} >> ~/.bashrc
|
||||||
|
|
||||||
if [ ! -d ~/.vim ]; then
|
if [ ! -d ~/.vim ]; then
|
||||||
|
|||||||
11
get_first_dev_ip.sh
Executable file
11
get_first_dev_ip.sh
Executable file
@@ -0,0 +1,11 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
for i in $(seq 0 3); do
|
||||||
|
ifname=$(ip -j a|jq -r .[$i].ifname)
|
||||||
|
if [[ "${ifname}" = "lo" ]]; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
echo $(ip -j a|jq -r \
|
||||||
|
".[$i].addr_info[] | select(.family == \"inet\") | .local")
|
||||||
|
break;
|
||||||
|
done
|
||||||
Reference in New Issue
Block a user