error handling, release builds
This commit is contained in:
5
.gitignore
vendored
5
.gitignore
vendored
@ -1,3 +1,4 @@
|
|||||||
.idea
|
.idea
|
||||||
epoch-linux
|
bin/
|
||||||
epoch-linux.tar.gz
|
epochcli-*
|
||||||
|
*.tar.gz
|
||||||
|
15
README.md
15
README.md
@ -1,23 +1,22 @@
|
|||||||
# epoch-linux
|
# epochcli
|
||||||
|
|
||||||
Linux updater and launcher for [Project Epoch](https://www.project-epoch.net/) Still a work in progress.
|
CLI tool for updating and launching [Project Epoch](https://www.project-epoch.net/) on Linux & macOS.
|
||||||
|
|
||||||
## TODO
|
## TODO
|
||||||
|
|
||||||
- better error handling
|
|
||||||
- improve config generation
|
- improve config generation
|
||||||
- add ability to launch Epoch after an update
|
- add ability to launch Epoch after an update
|
||||||
|
- Properly test on macOS
|
||||||
|
|
||||||
## Instructions
|
## Instructions
|
||||||
|
|
||||||
1. Set up a copy of WoW 3.3.5 in a wine prefix or launcher of your choice. Chromiecraft has a good torrent you can use for the 3.3.5 client
|
1. Set up a copy of WoW 3.3.5 in a wine prefix or launcher of your choice. Chromiecraft has a good torrent you can use for the 3.3.5 client
|
||||||
2. Install `epoch-linux` by either
|
2. Install `epochcli` by either
|
||||||
1. Download the latest binary from the [releases](https://git.burkey.co/eburk/epoch-linux/releases) page
|
1. Download the latest binary from the [releases](https://git.burkey.co/eburk/epoch-linux/releases) page
|
||||||
2. If you have the `go` toolchain installed, you can run `go install git.burkey.co/eburk/epoch-linux` to install to your `$GOROOT`
|
2. If you have the `go` toolchain installed, you can run `go install git.burkey.co/eburk/epochcli` to install to your `$GOROOT`
|
||||||
3. Compile the source yourself
|
3. Compile the source yourself
|
||||||
3. Run `epoch-linux` once. This will create a config file at `$HOME/.config/epoch-linux/config.toml`. Change the `WowDir` variable to your Wow game directory
|
3. Run `epochcli` once. This will create a config file at `$HOME/.config/epoch-linux/config.toml`. Change the `WowDir` variable to your Wow game directory
|
||||||
4. Run `epoch-linux` again. It will download the patch files from Epoch's servers to your Wow directory
|
4. Run `epochcli` again. It will download the patch files from Epoch's servers to your Wow directory
|
||||||
5. Use your launcher or tool of choice to startup Epoch in `wine`
|
5. Use your launcher or tool of choice to startup Epoch in `wine`
|
||||||
|
|
||||||
## Issues
|
## Issues
|
||||||
|
30
main.go
30
main.go
@ -14,9 +14,10 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
manifestUrl = "https://updater.project-epoch.net/api/manifest"
|
manifestUrl = "https://updater.project-epoch.net/api/manifest"
|
||||||
configDirName = "epoch-linux"
|
defaultWowPath = "/path/to/wow"
|
||||||
configName = "config.toml"
|
configDirName = "epoch-linux"
|
||||||
|
configName = "config.toml"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Config struct {
|
type Config struct {
|
||||||
@ -27,10 +28,10 @@ var (
|
|||||||
config Config
|
config Config
|
||||||
)
|
)
|
||||||
|
|
||||||
func setupConfig() {
|
func setupConfig() error {
|
||||||
home := os.Getenv("HOME")
|
home := os.Getenv("HOME")
|
||||||
if home == "" {
|
if home == "" {
|
||||||
log.Fatal("$HOME environment variable not set")
|
return fmt.Errorf("$HOME environment variable not set")
|
||||||
}
|
}
|
||||||
|
|
||||||
cfgPath := filepath.Join(home, ".config", configDirName, configName)
|
cfgPath := filepath.Join(home, ".config", configDirName, configName)
|
||||||
@ -39,18 +40,18 @@ func setupConfig() {
|
|||||||
os.MkdirAll(filepath.Join(home, ".config", configDirName), 0755)
|
os.MkdirAll(filepath.Join(home, ".config", configDirName), 0755)
|
||||||
|
|
||||||
newConfig := &Config{
|
newConfig := &Config{
|
||||||
WowDir: "/path/to/wow",
|
WowDir: defaultWowPath,
|
||||||
}
|
}
|
||||||
|
|
||||||
file, err := os.Create(cfgPath)
|
file, err := os.Create(cfgPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
return err
|
||||||
}
|
}
|
||||||
defer file.Close()
|
defer file.Close()
|
||||||
|
|
||||||
encoder := toml.NewEncoder(file)
|
encoder := toml.NewEncoder(file)
|
||||||
if err = encoder.Encode(newConfig); err != nil {
|
if err = encoder.Encode(newConfig); err != nil {
|
||||||
log.Fatal(err)
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Printf("Created new config at %s, edit it before running the launcher again\n", cfgPath)
|
fmt.Printf("Created new config at %s, edit it before running the launcher again\n", cfgPath)
|
||||||
@ -59,12 +60,21 @@ func setupConfig() {
|
|||||||
|
|
||||||
_, err := toml.DecodeFile(cfgPath, &config)
|
_, err := toml.DecodeFile(cfgPath, &config)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if config.WowDir == defaultWowPath {
|
||||||
|
return fmt.Errorf("WowDir in %s is still the default setting", cfgPath)
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
setupConfig()
|
err := setupConfig()
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
count, err := downloadUpdate()
|
count, err := downloadUpdate()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
19
release.sh
19
release.sh
@ -2,5 +2,20 @@
|
|||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
GOOS=linux GOARCH=amd64 go build
|
rm ./*.tar.gz
|
||||||
tar czvf epoch-linux.tar.gz ./epoch-linux
|
|
||||||
|
mkdir bin
|
||||||
|
|
||||||
|
GOOS=linux GOARCH=amd64 go build -o bin/epochcli-linux-amd64
|
||||||
|
tar czvf epochcli-linux-amd64.tar.gz bin/epochcli-linux-amd64
|
||||||
|
|
||||||
|
GOOS=linux GOARCH=arm64 go build -o bin/epochcli-linux-arm64
|
||||||
|
tar czvf epochcli-linux-arm64.tar.gz bin/epochcli-linux-arm64
|
||||||
|
|
||||||
|
GOOS=darwin GOARCH=amd64 go build -o bin/epochcli-darwin-amd64
|
||||||
|
tar czvf epochcli-darwin-amd64.tar.gz bin/epochcli-darwin-amd64
|
||||||
|
|
||||||
|
GOOS=darwin GOARCH=arm64 go build -o bin/epochcli-darwin-arm64
|
||||||
|
tar czvf epochcli-darwin-arm64.tar.gz bin/epochcli-darwin-arm64
|
||||||
|
|
||||||
|
rm -rf bin
|
Reference in New Issue
Block a user