Ready to test then bug fix :)

Also, I'm ALIVE!!!!
This commit is contained in:
Belac Darkstorm
2017-04-03 09:17:49 -05:00
parent 8441a8b752
commit 5d5cedec58
2 changed files with 72 additions and 8 deletions
+2 -3
View File
@@ -7,7 +7,6 @@ Just double click on an app to launch it! If there are multiple executables, you
# Apps:
Both of the below places provide linux executables that don't need libs installed on the host system:
[AppImage](https://bintray.com/probono/AppImages)
<s>[Orbital-Apps](https://www.orbital-apps.com/blog/2016/introducing-universal-orbs)</s> (Only works if the Orb-Launcher is installed on the system, for some reason. [Issue](https://github.com/CalebQ42/LinuxPA/issues/3))
# PortableApps.com Compatibility
LinuxPA works will with the PortableApps.com launcher, as it looks for apps in the PortableApps folder and grabs the app's name and icon from where it should be in the PortableApps.com format.
@@ -24,7 +23,7 @@ Because apps aren't natively formated in the PortableApps.com format, if LinuxPA
Right now AppImages are simply supported via the native linux executable support, but later I'm hoping to add downloading and automatic updating support later on.
# USB mount
Unfortunately Linux, by default, doesn't support running executables off of flash drives, requiring you to mount your drive with special mount arguments, I personally use the arguments `exec,noauto,nodev,nosuid,umask=0000`
Unfortunately Linux, by default, doesn't support running executables off of FAT formated flash drives, requiring you to mount your drive with special mount arguments or format in a linux friendly format (such as EXT4). I personally use the arguments `exec,noauto,nodev,nosuid,umask=0000`
# Screenshots
Photos are found [Here](https://goo.gl/photos/VtBUL6DyZTMidj5n6)
@@ -35,4 +34,4 @@ Photos are found [Here](https://goo.gl/photos/VtBUL6DyZTMidj5n6)
1. Add updater for .AppImage files
1. Download .AppImage files (maybe)
1. Check if all apps are closed when it closes and ask if you want to force stop the apps.
1. Portable wine???
1. Portable wine (Should be able to get a working version from PlayOnLinux, but I need to add a check to see if filesystem is EXT as Wine doesn't like filesystems w/o permission control)
+69 -4
View File
@@ -1,17 +1,18 @@
package main
import (
"bufio"
"fmt"
"io"
"net/http"
"os"
)
var (
updateNeeded = false
"strconv"
"strings"
)
const (
versionURL = "https://www.dropbox.com/s/a0xizzo0a4vsfqt/Version?dl=1"
downloadURL = "https://github.com/CalebQ42/LinuxPA/releases/download/vXXX/LinuxPA"
)
//Thanks to https://www.socketloop.com/tutorials/golang-download-file-example
@@ -26,6 +27,7 @@ func versionDL() bool {
return false
}
}
defer versionFile.Close()
check := http.Client{
CheckRedirect: func(r *http.Request, via []*http.Request) error {
r.URL.Opaque = r.URL.Path
@@ -33,6 +35,7 @@ func versionDL() bool {
},
}
response, err := check.Get(versionURL)
defer response.Body.Close()
if err != nil {
return false
}
@@ -42,3 +45,65 @@ func versionDL() bool {
}
return true
}
func getVersionFileInfo() string {
fil, err := os.Open("PortableApps/LinuxPACom/Version")
if err != nil {
return "Error!"
}
rdr := bufio.NewReader(fil)
out, _, _ := rdr.ReadLine()
return string(out)
}
func checkForUpdate(cur string, new string) bool {
curSlice := strings.Split(cur, ".")
newSlice := strings.Split(new, ".")
curNums := make([]int, 4)
newNums := make([]int, 4)
for i, v := range curSlice {
num, err := strconv.Atoi(v)
if err == nil {
curNums[i] = num
}
num, err = strconv.Atoi(newSlice[i])
if err == nil {
newNums[i] = num
}
if newNums[i] > curNums[i] {
return true
}
}
return false
}
func downloadUpdate(newVersion string) bool {
url := strings.Replace(downloadURL, "XXX", newVersion, -1)
err := os.Rename("LinuxPA", ".LinuxPA.old")
if err != nil {
fmt.Println(err)
return false
}
fil, err := os.Create("LinuxPA")
defer fil.Close()
if err != nil {
os.Rename(".LinuxPA.old", "LinuxPA")
return false
}
check := http.Client{
CheckRedirect: func(r *http.Request, via []*http.Request) error {
r.URL.Opaque = r.URL.Path
return nil
},
}
re, err := check.Get(url)
defer re.Body.Close()
if err != nil {
return false
}
_, err = io.Copy(fil, re.Body)
if err != nil {
return false
}
return true
}