Apply shellcheck advices

This commit is contained in:
Julien Malik 2015-09-06 22:36:49 +02:00
parent 0b5ffbc9a7
commit 97234cfced

View file

@ -48,7 +48,7 @@ $1
" 1>&2
tput sgr 0
notify_about_install_logs
exit ${2:-1}
exit "${2:-1}"
}
this_script_path() {
@ -60,7 +60,7 @@ this_script_path() {
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
echo $DIR
echo "$DIR"
}
ensure_root() {
@ -85,7 +85,7 @@ installscript_dependencies() {
-- \
apt-get -o Dpkg::Options::="--force-confold" \
-y install \
$packages \
"$packages" \
|| return 2
return 0
@ -148,7 +148,7 @@ setup_package_source() {
echo "deb http://repo.yunohost.org/ megusta main" > $CUSTOMAPT
# Also add repositories for 'testing' and/or 'unstable' if the script has been called with those arguments
if [[ "$#" > "0" ]]; then
if [[ "$#" -gt "0" ]]; then
if [[ "$1" == "test" ]] || [[ "$1" == "testing" ]] ; then
echo "deb http://repo.yunohost.org/ testing main" >> $CUSTOMAPT
fi
@ -172,9 +172,9 @@ apt_update() {
register_debconf() {
if [[ $(lsb_release -c | awk '{print $2}') == jessie ]];
then
debconf-set-selections $(this_script_path)/debconfjessie
debconf-set-selections "$(this_script_path)/debconfjessie"
else
debconf-set-selections $(this_script_path)/debconfv2
debconf-set-selections "$(this_script_path)/debconfv2"
fi
}
@ -199,10 +199,10 @@ workaround_avahi_installation() {
id avahi > /dev/null 2>&1 || return 0
# Get a random unused uid between 500 and 999 (system-user)
local avahi_id=$((500 + $RANDOM % 500))
while ! cat /etc/passwd | cut -d ':' -f 3 | grep -q $avahi_id ;
local avahi_id=$((500 + RANDOM % 500))
while ! cut -d ':' -f 3 /etc/passwd | grep -q $avahi_id ;
do
avahi_id=$((500 + $RANDOM % 500))
avahi_id=$((500 + RANDOM % 500))
done
# Use the same adduser parameter as in the avahi-daemon postinst script