Sun Dec 09, 2012 4:50 am
- /lib/live/overlay
- /lib/live/image
- /lib/live/rootfs
- /lib/live/mount
- /run/*
Sun Dec 09, 2012 1:52 pm
Sun Dec 09, 2012 3:13 pm
chroot /target hostname "$new_hostname"
Sun Dec 09, 2012 4:07 pm
Thu Mar 20, 2014 12:01 pm
Thu Mar 20, 2014 2:34 pm
#!/bin/bash
set -x
# Enter new hostname (or use the old hostname as the new one)
# Test to make sure it's a legal hostname, and let user fix it
# if it's not.
fix_hostname () {
new_hostname=$(yad --entry --title="Change hostname" \
--text="Illegal hostname. Try again.
You can use alphanumeric characters anywhere in the hostname, and
you can use the minus sign (-) as long as it's not at the beginning or end." \
--entry-text="$HOSTNAME" --width=500 --button="OK":0)
test_hostname
}
test_hostname () {
# if [[ $new_hostname =~ [_]|[@]|[~]|[\!]|[\#]|[=]|[+]|[\&]|[\^]|[\$]|[%]|[\(]|[\)]|[\*]|[\:]|[\;]|[\"]|[\']|[\`]|[,]|[.]|[\<]|[\>]|[\?]|[\{]|[\}]|[\[]|[\]]|[/]|[\|]|[\ ] ]]; then
if [[ $new_hostname =~ [_]|[@]|[~]|[\!]|[\#]|[=]|[+]|[\&]|[\^]|[\:]|[\;]|[\"]|[\']|[\`]|[,]|[.]|[\<]|[\>]|[\?]|[\{]|[\}]|[\[]|[\]]|[/]|[\|] ]]|[\ ]; then
fix_hostname
elif [[ $new_hostname = -* ]] || [[ $new_hostname = *- ]]; then
fix_hostname
elif [[ -z $new_hostname ]]; then
new_hostname="$HOSTNAME"
fi
}
select_hostname () {
new_hostname=$(yad --entry --title="Change hostname" \
--text="Enter new hostname for installed system." \
--entry-text="$HOSTNAME" --width=500 --button="OK":0)
test_hostname
}
select_hostname
echo "new_hostname is $new_hostname"
exit 0
Thu Mar 20, 2014 3:35 pm
test_hostname () {
if [[ $new_hostname =~ [_]|[@]|[~]|[\!]|[\#]|[=]|[+]|[\&]|[\^]|[\:]|[\;]|[\"]|[\']|[\`]|[,]|[.]|[\<]|[\>]|[\?]|[\{]|[\}]|[\[]|[\]]|[/]|[\|]|[\ ] ]]; then
fix_hostname
elif [[ $new_hostname =~ ["$"]|["%"]|["("]|[")"]|["*"] ]];then
fix_hostname
elif [[ $new_hostname = -* ]] || [[ $new_hostname = *- ]]; then
fix_hostname
elif [[ -z $new_hostname ]]; then
new_hostname="$HOSTNAME"
fi
}
Thu Mar 20, 2014 3:49 pm
Tue Mar 25, 2014 4:05 pm
test_hostname () {
if [[ $new_hostname =~ "$"|"%"|"("|")"|"*"|"_"|"@"|"~"|"!"|"#"|"="|"+"|"&"|"^"|":"|";"|"'"|","|"."|"<"|">"|"?"|"{"|"}"|"["|"]"|"/"|"|"|" " ]]; then
fix_hostname
elif [[ $new_hostname =~ "\""|"\`" ]];then
fix_hostname
elif [[ $new_hostname = -* ]] || [[ $new_hostname = *- ]]; then
fix_hostname
elif [[ -z $new_hostname ]]; then
new_hostname="$HOSTNAME"
fi
}
Thu Apr 03, 2014 12:51 pm