9 Commits

Author SHA1 Message Date
Belac Darkstorm f614c14013 Updated README 2016-09-13 03:30:27 -05:00
Belac Darkstorm 998c07b90b Update README 2016-09-13 03:26:08 -05:00
Belac Darkstorm 3d44c82e65 Updated README 2016-09-13 03:24:17 -05:00
Belac Darkstorm 08a453b5d5 Proper executable detection (looks for #! or ELF at the beginning of the file) 2016-09-13 02:54:59 -05:00
Belac Darkstorm be42963441 updated README 2016-09-09 09:31:27 -05:00
Belac Darkstorm 50ad374124 Added Screenshot 2016-09-09 09:30:14 -05:00
Belac Darkstorm f160e6d311 Added basic AppImage support. Added in common.sh support 2016-09-09 08:49:14 -05:00
Belac Darkstorm 6d946a123f UPdated README 2016-09-08 01:44:44 -05:00
Belac Darkstorm c758d57f2a Updated some stuff for the future 2016-09-03 22:02:00 -05:00
3 changed files with 80 additions and 25 deletions
+25 -18
View File
@@ -1,25 +1,32 @@
# LinuxPA
The goal is to create a fully functional PortableApps.com type launcher that can properly parse data from the PortableApps.com format. Apps are launched by a .sh file in the app's directory. Currently pulls out the Name and Category from App/AppInfo/appinfo.ini
Works well with AppImage apps.
LinuxPA is a try to bring a PortableApps.com type launcher to Linux.
# Why?
I know that Linux only has about 2% desktop usage and I know that the traditional way to install apps isn't portable, but over the past year or so I've started to put linux apps on my flash drive (AppImage is a great example of a portable solution to linux apps. Also a lot of DRM-free games can be run portably), but there was no easy way to organize my linux apps, so I created one. I personally have used the PortableApps.com launcher for years now and I love how properly formated the apps are, which allows me to grab info about the app easily.
# App Detection
LinuxPA looks in all folders in the PortableApps folder for, first, a script file (starts with the shebang (`#!`)) and, secondly, a native linux executable (starts with ELF). It will only add the first one it finds.
# Why script files?
In general linux executable files have no extensions and can be a pain when trying to figure out what is executable and what isn't. I figured script files are easy to detect and allow a large amount of flexibility for me (and others who want to make apps work with this launcher).
# PortableApps.com Compatability
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.
# Why Go?
Because I like Go :) Also the way it includes all it needs into one friendly executable.
# common.sh
common.sh is found in the PortableApps/LinuxPACom folder and is executed before the app. I mainly use it to set environment variables (such as HOME).
# What is needed?
Basically you need go to compile the source, AND YOU ALSO NEED TO MOUNT YOUR FLASH DRIVE SO YOU CAN EXECUTE FILES ON IT!!!! I've found that the mount arguments of `exec,noauto,nodev,nosuid,umask=0000` works well (I personally put my flash drive into /etc/fstab).
# Simple App Setup
Because apps aren't natively formated in the PortableApps.com format, if LinuxPA doesn't find the AppInfo.ini or appicon_\*.png in the App/AppInfo folder of the app it looks for them in the root direcory of the app (except it looks, nor for appicon_\*.png, but appicon.png)
# Format
The first place the program looks for an app's icon and info is in the /App/AppInfo directory (icon defaults to appicon_32.png, otherwise it just picks the last one it finds), but if it can't find the appinfo.ini or app icon, it looks in the apps root directory for appinfo.ini and appicon.png for info and icon respectively(Just to make it easier for custom settings in an app).
# AppImage Support
[AppImage Website](http://appimage.org)
Right now AppImages are simply supported via the native linux executable support, but later I'm hoping to add downloading and automatic downloading support.
# TODO
Add in a common.sh that is executed with each script. (Allows for setting environment variables such as HOME)
MAKE IT BETTER
Add an open button (I know, I just wanted to get the initial working before making it user friendly)
Check if all apps are closed when it closes and ask if you want to force stop the apps.
(Maybe)Create an installer.
# 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`
# Screenshots
Photos are found [Here](https://goo.gl/photos/VtBUL6DyZTMidj5n6)
# TODO (Might be in order)
1. MAKE IT BETTER
1. Launching of .exe files via wine (wine will have to be installed on the host system, unless there is some portable wine (I may have found one))
1. Add settings menu
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.
+46 -5
View File
@@ -4,6 +4,7 @@ import (
"bufio"
"os"
"path"
"reflect"
"sort"
"strings"
@@ -13,17 +14,28 @@ import (
var (
appMaster map[string][]prtap
cats []string
conf *os.File
common string
commEnbl bool
)
type prtap struct {
name string
cat string
ex string
desc string
}
func main() {
commEnbl = true
appMaster = make(map[string][]prtap)
os.Mkdir("PortableApps", 0777)
os.Mkdir("PortableApps/LinuxPACom", 0777)
common = "PortableApps/LinuxPACom/common.sh"
_, err := os.Open(common)
if os.IsNotExist(err) {
commEnbl = false
}
pa, err := os.Open("PortableApps")
if err != nil {
panic(err)
@@ -31,7 +43,7 @@ func main() {
appstmp, _ := pa.Readdir(-1)
var folds []string
for _, v := range appstmp {
if v.IsDir() {
if v.IsDir() && v.Name() != "LinuxPACom" {
folds = append(folds, v.Name())
}
}
@@ -68,11 +80,40 @@ func processApp(fi *os.File) (out prtap) {
if out.cat == "" {
out.cat = "other"
}
//executable detection
wd, _ := os.Getwd()
var rdr *bufio.Reader
for _, v := range fis {
if !v.IsDir() && strings.HasSuffix(v.Name(), ".sh") {
//do os check here for possible cross platform support
out.ex = fi.Name() + "/" + v.Name()
return
fil, err := os.Open(wd + "/" + fi.Name() + "/" + v.Name())
if err == nil {
stat, _ := fil.Stat()
if !stat.IsDir() {
rdr = bufio.NewReader(fil)
shebang := []byte{'#', '!'}
two := make([]byte, 2)
rdr.Read(two)
if reflect.DeepEqual(shebang, two) {
out.ex = wd + "/" + fi.Name() + "/" + v.Name()
rdr.Reset(fil)
return
}
}
}
}
for _, v := range fis {
fil, err := os.Open(wd + "/" + fi.Name() + "/" + v.Name())
if err == nil {
stat, _ := fil.Stat()
if !stat.IsDir() {
rdr = bufio.NewReader(fil)
thr := make([]byte, 4)
rdr.Read(thr)
if strings.Contains(string(thr), "ELF") {
out.ex = wd + "/" + fi.Name() + "/" + v.Name()
rdr.Reset(fil)
return
}
}
}
}
return prtap{}
+9 -2
View File
@@ -43,7 +43,12 @@ func uiMain(dri gxui.Driver) {
if appAdap.ItemIndex(applist.Selected()) != -1 {
app := applist.Selected().(prtap)
dir, fi := path.Split(app.ex)
cmd := exec.Command("/bin/sh", "-c", "cd \""+dir+"\"; \"./"+fi+"\"")
var cmd *exec.Cmd
if commEnbl {
cmd = exec.Command("/bin/sh", "-c", ". "+common+" || exit 1;cd \""+dir+"\"; \"./"+fi+"\"")
} else {
cmd = exec.Command("/bin/sh", "-c", "cd \""+dir+"\"; \"./"+fi+"\"")
}
cmd.Stdin = os.Stdin
cmd.Stdout = os.Stdout
cmd.Start()
@@ -53,5 +58,7 @@ func uiMain(dri gxui.Driver) {
top.AddChild(but)
top.AddChild(spl)
win.AddChild(top)
win.OnClose(dr.Terminate)
win.OnClose(func() {
dr.Terminate()
})
}