Giter VIP home page Giter VIP logo

gitea-installer's People

Contributors

bouzourene avatar flobee avatar

Watchers

 avatar  avatar

gitea-installer's Issues

download.sh does not check SHA256 hashes properly, failing silently

Hello, it's me again. I have a more specific issue for you this time, encountered during an update run. When I ran sudo ./update.sh I saw this:

Download url: 'https://dl.gitea.com/gitea/1.20.5/gitea-1.20.5-linux-arm64'
Download sources now? (defaut: 'Y')
Confirm (Y)es,(n)o (def:'Y'): 
/tmp/latest                  100%[=============================================>] 121.93M  5.55MB/s    in 22s     
/tmp/latest.sha256           100%[=============================================>]      91  --.-KB/s    in 0s      
Download checksum check...
sha256sum: gitea-1.20.5-linux-arm64: No such file or directory
OK
# install binary
---------------------------------------------------------------------
If you dont see any erros.. the service was removed, re-added and
gitea was started again. (If you run this script e.g for updates)

NOTE: gitea app.ini is temporary set with write rights for user git so that the
Web installer could write the configuration file.
After installation is done it is recommended to set rights to read-only to keep
the config secure. Please run:

    chmod 750 /home/git/tea/custom/conf/
    chmod 640 /home/git/tea/custom/conf/app.ini
    chown -R root:git /home/git/tea/custom/conf/

To check if the service is runing:
    systemctl status gitea.service

Checking migration status:
    tail -f /home/git/tea/log/gitea.log

Happy git + tea :)

Notice these lines in particular:

Download checksum check...
sha256sum: gitea-1.20.5-linux-arm64: No such file or directory
OK

So the update script attempts to check the SHA256 hash, fails, and then continues anyway. This surely is not intended behaviour?

Inside the download.sh script, it says this:

if [ `sha256sum --status -c "${GITEA_BIN_BASENAME}.sha256"` ]; then
    echo 'Checksum error';
    exit 1;
else
    echo "OK";
fi

There are two problems. The first is that the logic in the above if is inverted: sha256sum --status -c will return success (0) if it finds the file and its hash matches, and in that case it will hit the 'Checksum error' condition. Only if the sha256sum call fails to match the hash will it hit the "OK" condition. Easy solution is to switch the positions of the two outcomes.

The second problem is that the sha256sum program assumes the file will have the same name as it does in the hash file, i.e. the same name as on the server. But download.sh saves the file to latest (and the hash to latest.sha256). This seems to be a consequence of GITEA_BIN_BASENAME being defined in config.sh-dist, which is invoked prior to config.sh, and thus any variables which depend on fields changed by config.sh will not be updated. Solving this might need a little bit of refactoring so that dependent variables wait until config.sh is loaded before being defined. Or (possibly) download.sh does not override the output file name from what the server calls the file.

Difficulties with recent Debian/Gitea versions

Hello,

I recently used these scripts to install a new instance of Gitea 1.19.3 on Debian Bookworm running on RaspberryPi 4 (64bit) hardware. I succeeded eventually, but not without some hiccups (sorry for posting multiple issues together - I have limited time):

  • Backup fails and generates mess if "git" user not yet created; backup is enabled by default but should be disabled on first install
  • arm64 build isn't part of the default list of binaries in config.sh-dist
  • sha256sum complains about missing file after download (possible silent failure here?)
  • install.sh creates some folders and forgets to chown them to "git" user
  • On first gitea start: "...s/setting/setting.go:186:SetCustomPathAndConf() [W] Using 'custom' directory as relative origin for configuration file: '/home/git/tea/custom/custom/conf/app.ini'": this causes the initial configuration file to be written to the wrong location (note the double "custom/" in the message).
  • If you do "chmod 750 /home/git/tea/custom/conf/", "chmod 640 /home/git/tea/custom/conf/app.ini", and "chown -R root:git /home/git/tea/custom/conf/" as the script advises, gitea will fail to start; log says "...s/setting/setting.go:369:CreateOrAppendToCustomConf() [F] error saving to custom config: open /home/git/tea/custom/conf/app.ini: permission denied". Fixed this by chowning back to user "git".

I addressed each of those problems as I went, and now have a working Gitea server. Thanks for your helpful scripts!

Best,
Brendon

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.