zoukankan      html  css  js  c++  java
  • How to host your own Cydia repo with Github Pages

    Notice: There are many other ways to reach this, this is just one of them. Some steps could be improved, and some error will happen, such as failed to fetch error  SSL –9836. For SSL –9836, you need to set customize domain for your github page, or use the latest Cydia for your iphone device (not pretty sure). BTW, good luck for you!

     

    What I used:

    - An old Windows 7 PC
    - An ancient iPhone 4
    - iOS 6.1.3 and 7.1.2
    If you have a different setup, this tutorial should also work. You will not need to have Windows installed or set up a huge environment, you don't even need your PC for anything, everything is also possible to do on your iPhone as well!

    The overall principle

    1. Create a Github account and set up a repository for your website.
    2. Set up a Cydia depiction website for your repo.
    3. Collect all the configuraion files ("DEBIAN/control") from your packages and put them together in a big Packages file.
    4. Gzip and Bzip2 this Package file.
    5. Craft a Release file.
    6. Upload your mad stuff to your .github.io website.
    7. Test everything for at least 3 days. No bugs? Finished, congratulations :)

    1: Create a Github website

    First, you will need a Github account. No one yet? Go, create one at https://github.com/. Log into your account now and create a new repository and name it "[your userame here].github.io". If you do not so, your github website will not work! When i did this process, i was guided very good through the process of creating so you should be able to manage this easily.

    2: Set up Cydia depiction sites

    Well, now it is getting complicated :D

    This is a very important step because the depiction sites are mostly the only thing a user sees from your whole work. Also it is important that your backend is stable and easy to modify, mostly the design template. Imagine you have 1000 different Packages in your repo and if you want to make one change in your design, you had to edit a thousand files! Unfortunately, github pages is no full-fledged website server system, so if you thought (just like me) of PHP, i have to destroy your dreams now. Github pages is 100% static. Or is it? Are we doomed now? No we are not, because of our savior JavaScript! Yes, it is possible to write semi-dynamic websites with javascript and it is quite trivial, though!

    Just look at the source code of this website, it is just an empty page if you delete the JavaScript block on the bottom, all design stuff is done within a file called template.js. For my Cydia repo depictions i used a different template which you can find here: https://github.com/H6nry/h6nry.github.io/blob/master/repo/dptemplate.js Feel free to use it as well, just send me an e-mail and say "Thank you" if you like it.
    So we have a cool design template now and we can finally set up a folder structure. I used a very simple one, just look around here: https://github.com/H6nry/h6nry.github.io/blob/master/repo/ 

    3: Set up the Packages file

    As you may have noticed, there is a Packages file in the directory from the link above. Creating this can be a pain if you do it all by hand, so some smart devs (including Saurik) made a smart packaging shell-script named dpkg-scanpackages.

    You can find it here: http://test.saurik.com/macciti/dpkg-scanpackages. You will also need a file called dpkg-gettext.pl which you can find by searching around the internet a bit (or just click this link :P). Next, to avoid any problems, you have to edit these files and remove all the Windows CRLF return characters at the end of the lines. If you have notepad++ installed go to Edit>Linefeed format>Convert to Unix. If you are doing this on a Linux environemt or directly on your iPhone, just skip, everything should be alright.

    This script is written in Perl, which means you will need to install Perl before you can do anything. You will also need to have dpkg installed. The only device i have at the moment, which has dpkg AND Perl installed, is my iPhone. So go, find a Cydia repo from where you can install Perl (i am using http://coolstar.org/publicrepo/) and install. The other package, dpkg should already be installed because of Cydia. Now copy over your folder with the .deb packages and run dpkg-scanpackages over it. If your package folder is "Files" for example, write:

    ./dpkg-scanpackages Files /dev/null > Packages
    You will also have to make sure that everything has the right permissions, otherwise you will get a "permission" error. If you get a "bad interpreter" error, you did not convert the CRLF-linefeed-characters properly! Go and redo this! If you got a "some files [blabla] were not added [blabla]" error, everything went fine :D

    If you finally have a got a filled package file, you will need to edit it manually to fit it to your needs. For example if you have a beta package in your repo but you have a stable version in one of the standard repos, you maybe need to change the package identifier. Also you will need to add a "Depiction:" entry to all of your packages so the user sees your stylish website from step two. I even had to edit the "Author:" and "Maintainer:" entries to fit my contact information. It is best to read through the whole file once or twice to make sure you did not forget anything ;).

    4: Gzip and Bzip2 your Packages file

    For some reason (which i can not understand) Cydia wants the Package file in three different ways: One clear, one gzipped and one bzipped, so you will have to generate a "Packages", a "Packages.gz" and a "Packages.bz2".

    This is a quite trivial step but i am doing it via the command line on a tool suite named "Cygwin" because it is very fast to copy some commands and you can unite and automate the process of packaging and uploading easily on the command line (also because i am a Windows-er :P). So the commands you will need to execute are:

    rm Packages.gz
    rm Packages.bz2
    gzip -c9 Packages > Packages.gz
    bzip2 -c9 Packages > Packages.bz2

    What happens here: Remove any previous Packages.[bla] files, gzip/bzip2 the new one, and write them to a new file.

    You will need to copy these to your root repo directory alongside with an (optional) index.html and the Release file which we will craft in a moment.

    Well, if you tried with above command line tools, you could bzip2 Packages file with 7-Zip. Just as the following image. With such method, you do not even need to create .gz file at all.
    bzip2

    5: Craft a Release file

    Cydia will look for this Release file at first to make sure it was given the right URL and the repo the user wants to add is okay to add. A Release file looks like the following:

    Origin: H6nry
    Label: H6nry's repo
    Suite: stable
    Version: 1.0
    Codename: h6nryrepo
    Architectures: iphoneos-arm
    Components: main
    Description: H6nry's Cydia Repository

    Feel free to play around with these values and look what effect they have, you might find some interesting features! (I left out this step completely, email me if you found out some cool thing!). If you are done, copy this into your repo's root directory (if not done already).

    Optionally, you can also add an icon named "CydiaIcon.png" in your root dir so the user finds your repo at a glance.

    6: Upload your mad stuff

    To upload your stuff, you have several possibilities but i am choosing (as always) the command line. You will need to install a program named git because this is the only and most popular way to upload anything to your repo.

    When you installed git, execute the following:

    git clone https://github.com/[your username here]/[your username here].github.io.git
    cd [your username here].github.io

    What happens here: clone your github repo to your local directory so you can edit it to upload it again. Then, for convenience, change directory to your newly created repo dir.

    You will need to clone your github repo only once as long as you do not change anything from another computer (or user or directory) than the one you have just created.

    Next step is to copy/move your whole new website to this folder and prepare it for uploading (remove strange comments , debug stuff...). Upload your website with the following:

    git add -A
    git commit -m "Repo stuff"
    git push -u origin master

    What happens here: Add all files and dirs and files in dirs to the "upload list", prepare for uploading, upload everything.

    You will be asked for your username and password during the process, these are the same ones like you would log in regularily to github.com in a browser. You may see quite a lot of information of what is being uploaded and committed... you can ignore most of this ;).

    If you do not like work with above command lines, you could find GitHub Desktop which can be found in the github offical web site.

    7: Test everything!

    The most important thing is that you test everything properly to make sure the user will get a uniquely good experience and he will keep your repo in his Cydia repo list.

    For testing your repo website properly, i recommend strongly that you install iCleaner by Exile90 (i always use the pro version from his private repo because i know what i am doing ;P). The "problem" with Cydia is, because it wants to give the user fast loading times, it caches every depiction page. If you change now anything, you maybe will not see anything from your changes because of this. "iCleaner" fixes this by clearing Cydia caches. Just tap "Cydia" in the middle-tab and then "Clean" in the appearing menu.

    Okay, now TEST EVERYTHING, really every little thing, search for every possibility to make your stuff misbehave and fix it! No matter how little your bug is: The user will find it and will be frustrated about it! So test, test, test!

    Done with testing? Congratulations, you just managed to set up your own Cydia repository from scratch! If you like this tutorial, spread the word and say thanks to me (or if you want to tell me anything or have any questions left).

    8: Questions and how to fix ?

    ERROR: Failed to fetch https://xxx.github.io/repo/ SSL -9836

    Solution: GitHub stopped supporting TLS 1.1 which is what Cydia uses, so cydia repo hosted on GitHub are not working right now. HTTPS enforcement is required for GitHub Pages sites created after June 15, 2016 and using a github.io domain. So, you have two solutions :

    1. find a github.io repository older than June 15, 2016
    2. set a custom domain name on your github.io
    3. create your own http file server, such as apache/nginx web server

    Ref: https://h6nry.github.io/tutorial-cydia-repo.html
    Ref: https://github.com/vXBaKeRXv/vxbakerxv.github.io/issues/2

  • 相关阅读:
    我是卡拉 上海国际工业博览会纪实(4)
    GDI+中常见的几个问题(1)
    我是卡拉 上海国际工业博览会纪实(2)
    GDI+中常见的几个问题(9)
    GDI+中常见的几个问题(3)
    我是卡拉 上海国际工业博览会纪实(7)
    贵阳的小吃
    Indigo是啥
    我是卡拉 上海国际工业博览会纪实(3)
    云计算里AWS和Azure的探究(1)
  • 原文地址:https://www.cnblogs.com/open-coder/p/12732510.html
Copyright © 2011-2022 走看看