.entry-views-count{ display: none !important; }

Java-based iPodLinux Package Manager


For my Computer Info Sci culminating project I wrote up a small package manager for “installing” iPL via the loop-mount method. It basically just installs Loader 2 via ipodpatcher and extracts archives to your iPod. Due to its rushed nature (i.e. project to be handed in on Monday) it is far from complete and I won’t even bother listing what else needs to be done/added.

For testing purposes, it downloads a packlist from here and installs a minimal ZeroSlackr system (a very old version with outdated components but works for demo purposes). At this stage it doesn’t even differentiate between a kernel archive and a pack archive. All it does is call ipodpatcher and extract files. Really just a bunch of code slapped together for now.

The package managing part of the program I can fix and improve. The only real problem I have is iPod detection. Since I only need to demonstrate that the program roughly works on Windows and doesn’t need to be perfect (for the culminating project at least), my iPod detection code is just a loop through all the drives looking for the “iPod_Control” folder. I’ve looked at both the ipodpatcher and Installer 2 code but my limited knowledge in both Java-hardware communication and iPod hardware in general prevents me from really doing much else. Any help in this area would be greatly appreciated.

So here is the incomplete prototype. The archive is just the Eclipse project 7-zip’d with compiled jar files in the “export” folder. It is also just command-line for now (i.e. run it with “java -jar zeroslackr-lazy-installer-cmd.jar [OPTIONS]” through a command-line) as I am not too familiar with GUI in Java (though I can always just use one of those cheap GUI builders like Jigloo). Again this is just a rushed-but-semi-works version that needs a lot of fixing/cleaning up. It is not for practical use yet but just “Software Development” (i.e. looking at the source code for help/suggestions). Nevertheless, any feedback will be appreciated.


Thanks mucho Rufus. I played around with your code and re-did using /proc/mounts (never knew it existed before). I prefer Scanner over BufferedReader as thats what I’m more use to. I also didn’t realize I used pathSeparatorChar instead of separatorChar (whoops). I also had to change how checking/returning is done since Windows returns it with the unwanted extra “\” (all my extract methods start with a separatorChar).

     * Get path to iPod.
     * Precondition: iPod is mounted
     * (i.e. as a removable drive for Windows, 
     * in "/Volumes/" for Mac OS X, 
     * or in somewhere for Linux)
     * @return Path to iPod's root, null if not found.
    public static String getiPodPath() {
        final String CHECK_DIR = "iPod_Control";
        File[] roots;
        switch (getHostOS()) {
            case -1: // Unsupported host
            case 1: // Windows
                roots = File.listRoots();
                for (File f: roots) {
                    String path = f.getAbsolutePath();
                    if (new File(path + CHECK_DIR).exists()) {
                        // Need to remove the ending "\"
                        return path.substring(0, path.length()-1);
            case 2: // Mac OS X
                roots = new File(Tools.convertPath("/Volumes/")).listFiles();
                for (File f: roots) {
                    String path = f.getAbsolutePath();
                    if (new File(path + File.separatorChar + CHECK_DIR).exists()) {
                        return path;
            case 3: // Linux - Thanks mucho to Rufus!
                try {
                    Scanner proc = new Scanner(new File("/proc/mounts"));
                    String procLine;
                    ArrayList<file> mounts = new ArrayList</file><file>();
                    while (proc.hasNextLine()) {
                        procLine = proc.nextLine();
                        int i = procLine.indexOf(' ') + 1;
                        mounts.add(new File(procLine.substring(i, procLine.indexOf(' ', i))));
                    roots = new File[mounts.size()];
                    roots = mounts.toArray(roots);
                } catch (IOException e) {
                    File[] mnt = new File("/mnt/").listFiles();
                    File[] media = new File("/media/").listFiles();
                    roots = new File[mnt.length + media.length];
                    System.arraycopy(mnt, 0, roots, 0, mnt.length);
                    System.arraycopy(media, 0, roots, mnt.length, media.length);
                for (File f: roots) {
                    String path = f.getAbsolutePath();
                    if (new File(path + File.separatorChar + CHECK_DIR).exists()) {
                        return path;
        } //switch
        return null;

    } // getiPodPath


iPodLinux forums: http://ipl.derpapst.org/oldforums/viewtopic.php?t=29241

Check Also

Beats 1.7.1b FINAL

Post Views: 0 Been super busy with school (just graduated earlier this year) and work …