error handling, release builds

This commit is contained in:
2025-06-05 11:32:02 -07:00
parent 58f3977707
commit 027a8e073b
4 changed files with 47 additions and 22 deletions

5
.gitignore vendored
View File

@ -1,3 +1,4 @@
.idea
epoch-linux
epoch-linux.tar.gz
bin/
epochcli-*
*.tar.gz

View File

@ -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
- better error handling
- improve config generation
- add ability to launch Epoch after an update
- Properly test on macOS
## 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
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
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. 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
4. Run `epoch-linux` again. It will download the patch files from Epoch's servers to your Wow 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 `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`
## Issues

30
main.go
View File

@ -14,9 +14,10 @@ import (
)
const (
manifestUrl = "https://updater.project-epoch.net/api/manifest"
configDirName = "epoch-linux"
configName = "config.toml"
manifestUrl = "https://updater.project-epoch.net/api/manifest"
defaultWowPath = "/path/to/wow"
configDirName = "epoch-linux"
configName = "config.toml"
)
type Config struct {
@ -27,10 +28,10 @@ var (
config Config
)
func setupConfig() {
func setupConfig() error {
home := os.Getenv("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)
@ -39,18 +40,18 @@ func setupConfig() {
os.MkdirAll(filepath.Join(home, ".config", configDirName), 0755)
newConfig := &Config{
WowDir: "/path/to/wow",
WowDir: defaultWowPath,
}
file, err := os.Create(cfgPath)
if err != nil {
log.Fatal(err)
return err
}
defer file.Close()
encoder := toml.NewEncoder(file)
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)
@ -59,12 +60,21 @@ func setupConfig() {
_, err := toml.DecodeFile(cfgPath, &config)
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() {
setupConfig()
err := setupConfig()
if err != nil {
log.Fatal(err)
}
count, err := downloadUpdate()
if err != nil {

View File

@ -2,5 +2,20 @@
set -e
GOOS=linux GOARCH=amd64 go build
tar czvf epoch-linux.tar.gz ./epoch-linux
rm ./*.tar.gz
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