Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| a9eeb3bb1c | |||
| 844a282fd7 | |||
| 9da352a315 | |||
| 34b8f7c926 | |||
| 5d5cedec58 | |||
| 8441a8b752 | |||
| d64d88e0a5 |
@@ -7,7 +7,6 @@ Just double click on an app to launch it! If there are multiple executables, you
|
|||||||
# Apps:
|
# Apps:
|
||||||
Both of the below places provide linux executables that don't need libs installed on the host system:
|
Both of the below places provide linux executables that don't need libs installed on the host system:
|
||||||
[AppImage](https://bintray.com/probono/AppImages)
|
[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
|
# 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.
|
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.
|
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
|
# 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
|
# Screenshots
|
||||||
Photos are found [Here](https://goo.gl/photos/VtBUL6DyZTMidj5n6)
|
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. Add updater for .AppImage files
|
||||||
1. Download .AppImage files (maybe)
|
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. 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)
|
||||||
|
|||||||
@@ -1,11 +1,19 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
|
"os/exec"
|
||||||
|
|
||||||
"github.com/nelsam/gxui"
|
"github.com/nelsam/gxui"
|
||||||
"github.com/nelsam/gxui/drivers/gl"
|
"github.com/nelsam/gxui/drivers/gl"
|
||||||
"github.com/nelsam/gxui/themes/dark"
|
"github.com/nelsam/gxui/themes/dark"
|
||||||
|
"github.com/nelsam/gxui/themes/light"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
version = "1.1.0.0"
|
||||||
|
defIni = "[basic]\ntheme=dk"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@@ -17,22 +25,50 @@ var (
|
|||||||
lin []string
|
lin []string
|
||||||
wine bool
|
wine bool
|
||||||
comEnbld bool
|
comEnbld bool
|
||||||
|
darkTheme = true
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
_, err := os.Open("PortableApps/LinuxPACom/common.sh")
|
updated := false
|
||||||
if err == nil {
|
os.MkdirAll("PortableApps/LinuxPACom", 0777)
|
||||||
comEnbld = true
|
stat, err := versionDL()
|
||||||
|
if stat {
|
||||||
|
res := getVersionFileInfo()
|
||||||
|
if res != "Error!" {
|
||||||
|
stat, err = checkForUpdate(res)
|
||||||
|
if stat {
|
||||||
|
downloadUpdate(res)
|
||||||
|
updated = true
|
||||||
|
} else {
|
||||||
|
fmt.Println(err)
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
fmt.Println("Failed Version File Info")
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
fmt.Println(err)
|
||||||
|
}
|
||||||
|
if updated {
|
||||||
|
cmd := exec.Command("./LinuxPA")
|
||||||
|
cmd.Stdin = os.Stdin
|
||||||
|
cmd.Stdout = os.Stdout
|
||||||
|
cmd.Start()
|
||||||
|
} else {
|
||||||
master = make(map[string][]app)
|
master = make(map[string][]app)
|
||||||
linmaster = make(map[string][]app)
|
linmaster = make(map[string][]app)
|
||||||
gl.StartDriver(appMain)
|
gl.StartDriver(appMain)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func appMain(dri gxui.Driver) {
|
func appMain(dri gxui.Driver) {
|
||||||
dr = dri
|
dr = dri
|
||||||
th = dark.CreateTheme(dr)
|
|
||||||
setup()
|
setup()
|
||||||
|
if darkTheme {
|
||||||
|
th = dark.CreateTheme(dr)
|
||||||
|
} else {
|
||||||
|
th = light.CreateTheme(dr)
|
||||||
|
}
|
||||||
|
th = dark.CreateTheme(dr)
|
||||||
ui()
|
ui()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"bufio"
|
"bufio"
|
||||||
|
"fmt"
|
||||||
"image"
|
"image"
|
||||||
"image/draw"
|
"image/draw"
|
||||||
_ "image/png"
|
_ "image/png"
|
||||||
@@ -13,10 +14,47 @@ import (
|
|||||||
"github.com/nelsam/gxui"
|
"github.com/nelsam/gxui"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const ()
|
||||||
|
|
||||||
func setup() {
|
func setup() {
|
||||||
PortableAppsFold, err := os.Open("PortableApps")
|
PortableAppsFold, err := os.Open("PortableApps")
|
||||||
if PAStat, _ := PortableAppsFold.Stat(); err != nil || !PAStat.IsDir() {
|
if PAStat, _ := PortableAppsFold.Stat(); err != nil || !PAStat.IsDir() {
|
||||||
panic("PortableApps folder not found!!")
|
os.Mkdir("PortableApps", 0777)
|
||||||
|
PortableAppsFold, err = os.Open("PortableApps")
|
||||||
|
if err != nil {
|
||||||
|
panic("Can't find PortableApps folder and can't create one!")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if _, err = os.Open("PortableApps/LinuxPACom"); err != nil {
|
||||||
|
os.Mkdir("PortableApps/LinuxPACom", 0777)
|
||||||
|
}
|
||||||
|
fmt.Println(err)
|
||||||
|
_, err = os.Open("PortableApps/LinuxPACom/common.sh")
|
||||||
|
if err == nil {
|
||||||
|
comEnbld = true
|
||||||
|
}
|
||||||
|
fi, err := os.Open("PortableApps/LinuxPACom/Info.ini")
|
||||||
|
if err != nil {
|
||||||
|
fi, err = os.Create("PortableApps/LinuxPACom/Info.ini")
|
||||||
|
if err == nil {
|
||||||
|
wrt := bufio.NewWriter(fi)
|
||||||
|
wrt.WriteString(defIni)
|
||||||
|
wrt.Flush()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if err == nil {
|
||||||
|
rdr := bufio.NewReader(fi)
|
||||||
|
for err != nil {
|
||||||
|
ln, _, error := rdr.ReadLine()
|
||||||
|
err = error
|
||||||
|
str := string(ln)
|
||||||
|
if strings.HasPrefix(str, "theme=") {
|
||||||
|
str = strings.TrimPrefix(str, "theme=")
|
||||||
|
if str == "lt" {
|
||||||
|
darkTheme = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
PAFolds, _ := PortableAppsFold.Readdirnames(-1)
|
PAFolds, _ := PortableAppsFold.Readdirnames(-1)
|
||||||
sort.Strings(PAFolds)
|
sort.Strings(PAFolds)
|
||||||
@@ -78,7 +116,7 @@ func processApp(fold string) (out app) {
|
|||||||
btys := make([]byte, 4)
|
btys := make([]byte, 4)
|
||||||
rdr := bufio.NewReader(tmp)
|
rdr := bufio.NewReader(tmp)
|
||||||
rdr.Read(btys)
|
rdr.Read(btys)
|
||||||
if (strings.Contains(strings.ToLower(string(btys)), "elf") && !strings.HasSuffix(strings.ToLower(v), ".so")) || strings.HasPrefix(strings.ToLower(string(btys)), "#!") {
|
if (strings.Contains(strings.ToLower(string(btys)), "elf") && !strings.HasSuffix(strings.ToLower(v), ".so") && !strings.Contains(v, ".so.")) || strings.HasPrefix(strings.ToLower(string(btys)), "#!") {
|
||||||
out.ex = append(out.ex, v)
|
out.ex = append(out.ex, v)
|
||||||
out.lin = append(out.lin, v)
|
out.lin = append(out.lin, v)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,106 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bufio"
|
||||||
|
"io"
|
||||||
|
"net/http"
|
||||||
|
"os"
|
||||||
|
"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
|
||||||
|
//For some of the code
|
||||||
|
|
||||||
|
//Returns if success
|
||||||
|
func versionDL() (bool, error) {
|
||||||
|
versionFile, err := os.Create("PortableApps/LinuxPACom/Version")
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
versionFile.Chmod(0777)
|
||||||
|
check := http.Client{
|
||||||
|
CheckRedirect: func(r *http.Request, via []*http.Request) error {
|
||||||
|
r.URL.Opaque = r.URL.Path
|
||||||
|
return nil
|
||||||
|
},
|
||||||
|
}
|
||||||
|
response, err := check.Get(versionURL)
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
_, err = io.Copy(versionFile, response.Body)
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
return true, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
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(new string) (bool, error) {
|
||||||
|
curSlice := strings.Split(version, ".")
|
||||||
|
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
|
||||||
|
} else {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
if newNums[i] > curNums[i] {
|
||||||
|
return true, nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func downloadUpdate(newVersion string) (bool, error) {
|
||||||
|
url := strings.Replace(downloadURL, "XXX", newVersion, -1)
|
||||||
|
err := os.Rename("LinuxPA", ".LinuxPA.old")
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
fil, err := os.Create("LinuxPA")
|
||||||
|
fil.Chmod(0777)
|
||||||
|
defer fil.Close()
|
||||||
|
if err != nil {
|
||||||
|
os.Rename(".LinuxPA.old", "LinuxPA")
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
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)
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
defer re.Body.Close()
|
||||||
|
_, err = io.Copy(fil, re.Body)
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
return true, nil
|
||||||
|
}
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"io"
|
||||||
|
"net/http"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"github.com/mholt/archiver"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
wineURL = "https://www.playonlinux.com/wine/binaries/linux-amd64/PlayOnLinux-wine-2.5-linux-amd64.pol"
|
||||||
|
)
|
||||||
|
|
||||||
|
func downloadWine() (bool, error) {
|
||||||
|
wineTar, err := os.Create("PortableApps/LinuxPACom/wine2.5.tar.bz2")
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
wineTar.Chmod(0777)
|
||||||
|
defer wineTar.Close()
|
||||||
|
check := http.Client{
|
||||||
|
CheckRedirect: func(r *http.Request, via []*http.Request) error {
|
||||||
|
r.URL.Opaque = r.URL.Path
|
||||||
|
return nil
|
||||||
|
},
|
||||||
|
}
|
||||||
|
resp, err := check.Get(wineURL)
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
defer resp.Body.Close()
|
||||||
|
_, err = io.Copy(wineTar, resp.Body)
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
err = archiver.TarBz2.Open("PortableApps/LinuxPACom/wine2.5.tar.bz2", "PortableApps/LinuxPACom/Wine")
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
return true, nil
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user