diff options
-rw-r--r-- | backends/artnet.c | 12 | ||||
-rw-r--r-- | backends/sacn.c | 10 | ||||
-rwxr-xr-x | installer.sh | 28 | ||||
-rw-r--r-- | installer_todo | 1 |
4 files changed, 22 insertions, 29 deletions
diff --git a/backends/artnet.c b/backends/artnet.c index 57eb7b1..e01f038 100644 --- a/backends/artnet.c +++ b/backends/artnet.c @@ -77,16 +77,12 @@ static int artnet_configure(char* option, char* value){ else if(!strcmp(option, "bind")){ mmbackend_parse_hostspec(value, &host, &port); - if(!port){ - port = ARTNET_PORT; - } - if(!host){ fprintf(stderr, "Not valid ArtNet bind address given\n"); return 1; } - if(artnet_listener(host, port)){ + if(artnet_listener(host, (port ? port : ARTNET_PORT))){ fprintf(stderr, "Failed to bind ArtNet descriptor: %s\n", value); return 1; } @@ -140,16 +136,12 @@ static int artnet_configure_instance(instance* inst, char* option, char* value){ else if(!strcmp(option, "dest") || !strcmp(option, "destination")){ mmbackend_parse_hostspec(value, &host, &port); - if(!port){ - port = ARTNET_PORT; - } - if(!host){ fprintf(stderr, "Not a valid ArtNet destination for instance %s\n", inst->name); return 1; } - return mmbackend_parse_sockaddr(host, port, &data->dest_addr, &data->dest_len); + return mmbackend_parse_sockaddr(host, port ? port : ARTNET_PORT, &data->dest_addr, &data->dest_len); } fprintf(stderr, "Unknown ArtNet option %s for instance %s\n", option, inst->name); diff --git a/backends/sacn.c b/backends/sacn.c index 2229b8a..edb648d 100644 --- a/backends/sacn.c +++ b/backends/sacn.c @@ -111,16 +111,13 @@ static int sacn_configure(char* option, char* value){ } else if(!strcmp(option, "bind")){ mmbackend_parse_hostspec(value, &host, &port); - if(!port){ - port = SACN_PORT; - } if(!host){ fprintf(stderr, "No valid sACN bind address provided\n"); return 1; } - if(sacn_listener(host, port, flags)){ + if(sacn_listener(host, port ? port : SACN_PORT, flags)){ fprintf(stderr, "Failed to bind sACN descriptor: %s\n", value); return 1; } @@ -155,16 +152,13 @@ static int sacn_configure_instance(instance* inst, char* option, char* value){ } else if(!strcmp(option, "destination")){ mmbackend_parse_hostspec(value, &host, &port); - if(!port){ - port = SACN_PORT; - } if(!host){ fprintf(stderr, "No valid sACN destination for instance %s\n", inst->name); return 1; } - return mmbackend_parse_sockaddr(host, port, &data->dest_addr, &data->dest_len); + return mmbackend_parse_sockaddr(host, port ? port : SACN_PORT, &data->dest_addr, &data->dest_len); } else if(!strcmp(option, "from")){ next = value; diff --git a/installer.sh b/installer.sh index eab9f50..fd4dd91 100755 --- a/installer.sh +++ b/installer.sh @@ -7,7 +7,6 @@ user=$(whoami) # for bypassing user check replace "$(whoami)" w script_path="`cd $0; pwd`" # Script dir tmp_path=$(mktemp -d) # Repo download path -Iversion="v0.2" # (fallback version if ) makeargs=all # Build args VAR_DESTDIR="" # Unused @@ -36,14 +35,25 @@ echo "" } INSTALL-PREP () { - echo "Starting Git!" - git clone https://github.com/cbdevnet/midimonster.git "$tmp_path" # Gets Midimonster - Iversion=(git describe --abbrev=0) # Get last tag(stable version) - echo "Starting Git checkout to "$Iversion"" +(#### Subshell make things like cd $tmp_path easier to revert + echo "Starting download..." + git clone https://github.com/cbdevnet/midimonster.git "$tmp_path" # Gets Midimonster + echo "" + echo "" + echo "Initializing repository..." + cd $tmp_path git init $tmp_path - git checkout $Iversion $tmp_path + echo "" + echo "Finding latest stable version..." + Iversion=$(git describe --abbrev=0) # Get last tag(stable version) + echo "Starting Git checkout to "$Iversion"..." + git checkout -f -q $Iversion + echo "Done." + ) echo "" + echo "" + echo "" read -e -i "$VAR_PREFIX" -p "PREFIX (Install root directory): " input # Reads VAR_PREFIX VAR_PREFIX="${input:-$VAR_PREFIX}" @@ -93,14 +103,10 @@ CLEAN () { ################################################ Main ################################################# - trap ERROR SIGINT SIGTERM SIGKILL clear -if [ $user != "root" ]; then # Check if $user = root! - echo "Installer must be run as root" - ERROR -fi +if [ $user != "root" ]; then echo "Installer must be run as root"; ERROR; fi # Check if $user = root! if [ $(wget -q --spider http://github.com) $? -eq 0 ]; then "INSTALL-DEPS"; else echo You need connection to the internet; ERROR ; fi diff --git a/installer_todo b/installer_todo new file mode 100644 index 0000000..c9935ae --- /dev/null +++ b/installer_todo @@ -0,0 +1 @@ +-Updater (Remote Repo letzten tag lesen und mit lokaler installation abgleichen)
\ No newline at end of file |