Skip to content

Commit 6228bf6

Browse files
author
Giles Westwood
committed
sync over some fixes
1 parent b5e07d1 commit 6228bf6

File tree

5 files changed

+32
-7
lines changed

5 files changed

+32
-7
lines changed

lib/github.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,15 @@ sk-github(){
428428
_sk-github_curl https://api.github.com
429429
}
430430

431+
sk-github-release-list-latest(){
432+
local owner_repo="${1:-sigoden/upt}"
433+
local output=''
434+
sk-git-creds
435+
echo "https://api.github.com/repos/$owner_repo/releases/latest"
436+
output=`_sk-github_curl https://api.github.com/repos/$owner_repo/releases/latest`
437+
echo $output | jq -r '.'
438+
}
439+
431440
sk-github-org-list-watchers(){
432441
local reponame=$1
433442
local output=''

lib/logger.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ _sk_logger_common(){
88
log_name="${LOG_NAME:-"${NAME}.log"}"
99

1010
if [[ $EUID -ne 0 ]];then
11-
log_dir_default=~/log
11+
log_dir_default="${HOME}/log"
1212
else
1313
log_dir_default=/var/log/shellkit
1414
fi
@@ -18,7 +18,10 @@ _sk_logger_common(){
1818
export LOG_DIR=$log_dir
1919

2020
if [[ ! -d "$log_dir" ]];then
21-
sk-dir-make $log_dir
21+
if ! sk-dir-make $log_dir;then
22+
log_dir=/tmp
23+
export LOG_DIR=$log_dir
24+
fi
2225
# dont use logrotate if we have a date based log_dir
2326
year=$(date +"%Y")
2427
if ! grep -q $year <<< $(echo $log_dir);then

lib/logrotate.sh

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,18 @@ sk-logrotate(){
2626

2727
sk-pack-install -b logrotate --post_install 'brew services start logrotate'
2828

29-
if [[ -d /usr/local/etc/logrotate.d ]];then
30-
logrotate_config_file=/usr/local/etc/logrotate.d/${config_name}
31-
export LOGROTATE_CONFIG_FILE=$logrotate_config_file
32-
logrotate_sudo=0
29+
if [[ "$PLATFORM" = 'Darwin' ]];then
30+
31+
if [[ -d /opt/homebrew/etc/logrotate.d ]];then
32+
logrotate_config_file=/opt/homebrew/etc/logrotate.d/${config_name}
33+
export LOGROTATE_CONFIG_FILE=$logrotate_config_file
34+
logrotate_sudo=0
35+
elif [[ -d /usr/local/etc/logrotate.d ]];then
36+
logrotate_config_file=/usr/local/etc/logrotate.d/${config_name}
37+
export LOGROTATE_CONFIG_FILE=$logrotate_config_file
38+
logrotate_sudo=0
39+
fi
40+
3341
else
3442
logrotate_config_file=/etc/logrotate.d/${config_name}
3543
export LOGROTATE_CONFIG_FILE=$logrotate_config_file

lib/sys.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ alias pc="pre-commit"
77
alias pci="pre-commit install"
88
alias pca="sk-pre-commit-all"
99

10+
sk-host-to-fqdn(){
11+
local host="${1:-localhost}"
12+
host "$host" | awk '/has address/ {print $1}'
13+
}
14+
1015
sk-group-user-uid-highest(){
1116
group_name="${1:-wibble}"
1217

lib/xml.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ END {
3232
}
3333

3434
sk-xml-pretty(){
35-
sk-pack-install -b xmllint -p libxml2-utils
35+
sk-pack-install -b xmllint --keg_force -p libxml2-utils --mac_package libxml2
3636
xmllint --format "$@"
3737
}
3838

0 commit comments

Comments
 (0)