2022-09-17 06:04:15 +00:00
|
|
|
[[ -r /etc/apt/sources.list ]] \
|
|
|
|
&& ixsystems_system=$(cat /etc/apt/sources.list | grep '^deb https\?://apt\.tn\.ixsystems\.com' | wc -l) \
|
|
|
|
&& [[ $ixsystems_system -lt 11 ]] \
|
|
|
|
&& unset ixsystems_system
|
|
|
|
|
|
|
|
if [[ -n "$ixsystems_system" ]]; then
|
|
|
|
if ! [[ -r /tmp/truenas_scriptpath ]]; then
|
|
|
|
/sbin/zpool list -Ho name | \
|
|
|
|
grep -v 'boot-pool' | \
|
|
|
|
while read pool; do
|
|
|
|
/sbin/zfs list -rHo name $pool | \
|
|
|
|
grep "^$pool/[a-z\._]*data/_\?scripts"
|
|
|
|
done | \
|
|
|
|
while read dataset; do
|
|
|
|
/sbin/zfs list -Ho mountpoint $dataset
|
|
|
|
done > /tmp/truenas_scriptpath
|
|
|
|
fi
|
|
|
|
truenas_scriptspath=$(cat /tmp/truenas_scriptpath)
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ -n "$truenas_scriptspath" && -x "${truenas_scriptspath}/truetool/truetool.sh" ]]; then
|
2022-06-27 02:43:06 +00:00
|
|
|
function truetool() {
|
2022-09-17 06:04:15 +00:00
|
|
|
pushd ${truenas_scriptspath}/truetool > /dev/null
|
2022-06-27 02:43:06 +00:00
|
|
|
sudo ./truetool.sh "${@}"
|
|
|
|
popd > /dev/null
|
|
|
|
}
|
|
|
|
|
|
|
|
function truedcx() {
|
|
|
|
docker exec -it $(docker ps --filter "name=$1" -q) $2
|
|
|
|
}
|
|
|
|
function true-docker-id() {
|
|
|
|
docker ps --filter "name=$1" -q
|
|
|
|
}
|
|
|
|
function true-hostname() {
|
|
|
|
local ID=$(true-docker-id $1)
|
|
|
|
local autoHostname=$(docker inspect --format="{{ .Config.Hostname }}" $ID)
|
|
|
|
local contIP=$(docker exec $ID cat /etc/hosts | grep $autoHostname | awk '{print $1}')
|
|
|
|
docker exec $ID nslookup $contIP | tail +4 | sed 's/^[0-9]\+.*name = [-0-9]\+\.//'
|
|
|
|
}
|
|
|
|
fi
|