Skip to content

Use external installer #6

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 23 commits into from
Jul 27, 2015
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
enable clean operations using external installer
  • Loading branch information
facchinm committed Jul 24, 2015
commit 3efe2972760b830e5e9fb76e25ba877ef639571c
8 changes: 4 additions & 4 deletions compile_webidebridge.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,11 @@ createZipEmbeddableFileArduino()
cd arduino
zip -r arduino.zip arduino/* config.ini *.pem > /dev/null
cd ..
cat arduino/arduino.zip >> $3
zip --adjust-sfx $3
#cat arduino/arduino.zip >> $3
#zip --adjust-sfx $3
mkdir -p snapshot/$GOOS\_$GOARCH
cp $3 snapshot/$GOOS\_$GOARCH/$3
cp arduino/arduino.zip snapshot/$GOOS\_$GOARCH
ls -la snapshot/$GOOS\_$GOARCH/$3
}

Expand All @@ -53,7 +54,6 @@ bootstrapPlatforms()
env CC_FOR_TARGET=i686-w64-mingw32-gcc CGO_ENABLED=1 GOOS=windows GOARCH=386 ./make.bash --no-clean
}

set -x
compilePlatform()
{
echo 'In compilePlatform'
Expand All @@ -74,7 +74,7 @@ compilePlatform()
fi
echo createZipEmbeddableFileArduino $GOOS $GOARCH $NAME
createZipEmbeddableFileArduino $GOOS $GOARCH $NAME
GOOS=$GOOS GOARCH=$GOARCH go-selfupdate $NAME $VERSION
#GOOS=$GOOS GOARCH=$GOARCH go-selfupdate $NAME $VERSION
rm -rf $NAME*
}

Expand Down
69 changes: 38 additions & 31 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,12 @@ import (
)

var (
version = "1.83"
versionFloat = float32(1.83)
addr = flag.String("addr", ":8989", "http service address")
addrSSL = flag.String("addrSSL", ":8990", "https service address")
version = "1.83"
versionFloat = float32(1.83)
embedded_autoupdate = false
embedded_autoextract = false
addr = flag.String("addr", ":8989", "http service address")
addrSSL = flag.String("addrSSL", ":8990", "https service address")
//assets = flag.String("assets", defaultAssetPath(), "path to assets")
verbose = flag.Bool("v", true, "show debug logging")
//verbose = flag.Bool("v", false, "show debug logging")
Expand Down Expand Up @@ -89,19 +91,21 @@ func main() {
src, _ := osext.Executable()
dest := filepath.Dir(src)

// save the config.ini (if it exists)
if _, err := os.Stat(dest + "/" + *configIni); os.IsNotExist(err) {
fmt.Println("First run, unzipping self")
err := Unzip(src, dest)
fmt.Println("Self extraction, err:", err)
}
if embedded_autoextract {
// save the config.ini (if it exists)
if _, err := os.Stat(dest + "/" + *configIni); os.IsNotExist(err) {
fmt.Println("First run, unzipping self")
err := Unzip(src, dest)
fmt.Println("Self extraction, err:", err)
}

if _, err := os.Stat(dest + "/" + *configIni); os.IsNotExist(err) {
flag.Parse()
fmt.Println("No config.ini at", *configIni)
} else {
flag.Set("config", dest+"/"+*configIni)
iniflags.Parse()
if _, err := os.Stat(dest + "/" + *configIni); os.IsNotExist(err) {
flag.Parse()
fmt.Println("No config.ini at", *configIni)
} else {
flag.Set("config", dest+"/"+*configIni)
iniflags.Parse()
}
}

// setup logging
Expand All @@ -112,23 +116,26 @@ func main() {
launchSelfLater()
}

var updater = &Updater{
CurrentVersion: version,
ApiURL: *updateUrl,
BinURL: *updateUrl,
DiffURL: "",
Dir: "update/",
CmdName: *appName,
}
if embedded_autoupdate {

if updater != nil {
go updater.BackgroundRun()
}
var updater = &Updater{
CurrentVersion: version,
ApiURL: *updateUrl,
BinURL: *updateUrl,
DiffURL: "",
Dir: "update/",
CmdName: *appName,
}

// data, err := Asset("arduino.zip")
// if err != nil {
// log.Println("arduino tools not found")
// }
if updater != nil {
go updater.BackgroundRun()
}

// data, err := Asset("arduino.zip")
// if err != nil {
// log.Println("arduino tools not found")
// }
}

createGlobalConfigMap(&globalConfigMap)

Expand Down
1 change: 0 additions & 1 deletion utilities.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@ func pipe_commands(commands ...*exec.Cmd) ([]byte, error) {
commands[i].Stderr = &errorBuffer

if err := call(commands, pipeStack); err != nil {
logger.Errorf(string(errorBuffer.Bytes()), err)
return nil, err
}

Expand Down