Skip to content

Teacher vs Student auto-detection (read first)

The defining feature of cc-class is that you install the same package on every machine. After installation, each machine figures out by itself whether it is a "teacher" or a "student" — administrators do not need to do anything different per machine.

The decision is based on one thing only: the computer name (hostname).

1. The rule: which names count as "teacher"

A machine is treated as a teacher if its computer name matches any of the following (case-insensitive); otherwise it is a student.

  1. Contains a teacher keyword: the name includes teacher, jiaoshi, laoshi, or the Chinese 老师.
    • e.g. teacher-01, JiaoShi, lab1-老师
  2. Contains a -t / _t teacher tag: a standalone t delimited so that the character before it is -, _ or the start, and the character after it is -, _, a digit, or the end.
    • Matches: pc-t, lab-t-01, room1-t2, PC001-T
    • Does not misfire on: -test (t followed by e), team (t followed by e), host-time (t followed by i)
For technicians: the exact rule

The teacher tag is matched by the regex (^|[-_])t([-_]|[0-9]|$) (after lower-casing). The Windows installer (installer.nsi) and the Linux daemon (StudentService) embed identical logic, so the teacher app, student app and installer always agree.

RoleExample computer nameNote
Teacherteacher, teacher-01, PC-T, PC001-Tkeyword or -t tag
StudentPC001, PC002, stu-01, room1-15plain name, no teacher tag

Easiest scheme

Name the teacher machine PC001-T (ends with -T), and the students PC002, PC003, … This manual's demo environment uses exactly that: teacher PC001-T, students PC002 and PC003.

2. Cloud-desktop name precedence (important)

Many labs use cloud-desktop / diskless (IDV/VOI) solutions where many machines boot from the same image, so the OS hostname may be identical across machines. To handle this, cc-class resolves the name as follows:

  1. First, read the "cloud-desktop computer name" pushed by the platform:
    • Linux: from device /dev/vdchardev;
    • Windows: from device \\.\vddsk.
  2. Only if that device is absent / unreadable / empty does it fall back to the OS hostname.

In other words: cloud-desktop name > OS hostname. In a cloud-desktop environment, set the machine's cloud-desktop computer name (e.g. PC001-T) on the management platform — not just the OS hostname.

Common pitfall

If the OS hostname is PC001-T (looks like a teacher) but the cloud-desktop name pushed down is PC001 (a student), cc-class uses the cloud name PC001 and treats it as a student, so the teacher app refuses to start. When troubleshooting, trust the "cloud-desktop computer name".

3. What the decision causes (automatic behavior)

If the machine is…TeacherAppStudentAppDesktop shortcut
Teacherstarts normallyexits automatically (the student app does not run on a teacher)creates the Teacher icon only
Studentshows "not a teacher machine, will not start"runs and auto-connects to the teachercreates no desktop icon (keeps the desktop clean)
  • The student app quietly exits on a teacher machine (returns 0, no disturbance).
  • The teacher app warns and exits on a student machine. In emergencies you can add the command-line flag --no-host-check to skip the check (see FAQ).

4. Desktop shortcuts: automatic, no manual work

You do not create icons by hand. cc-class handles them per role and cleans up any leftover wrong-role icons:

  • Teacher machine: a cc-class Teacher icon is placed on the desktop.
    • On Linux, the student daemon StudentService rebuilds it at every boot based on the cloud-desktop name, and automatically sets GNOME's metadata::trusted so the icon is not shown as an "untrusted application launcher" (which would make double-click do nothing).
    • On Windows, the installer creates …-Teacher.lnk based on the computer name.
  • Student machine: no desktop icon at all (an entry still exists in the application menu for troubleshooting).

Actual result in the demo environment (checking the desktop folders):

text
# Teacher PC001-T desktop: has the teacher icon
~/Desktop/cc-class-teacher.desktop

# Student PC002 / PC003 desktops: empty (no cc-class icon)
(none)

Changed the computer name?

Just reboot. At boot the daemon re-evaluates the role with the new name and rebuilds/cleans the desktop icon — fully automatic.

5. Decision flow

                ┌─────────────────────────────┐
                │  Read "cloud-desktop name"   │
                │  Linux:   /dev/vdchardev     │
                │  Windows: \\.\vddsk          │
                └──────────────┬──────────────┘
              non-empty │ otherwise fall back
                ┌──────────────▼──────────────┐
                │      Use the OS hostname     │
                └──────────────┬──────────────┘

        name contains teacher / jiaoshi / laoshi / 老师
        or a -t / _t teacher tag?
                       ┌───────┴───────┐
                    yes│               │no
                ┌──────▼──────┐ ┌──────▼──────┐
                │   Teacher   │ │   Student   │
                │ run teacher │ │ run student │
                │ make icon   │ │ no icon     │
                └─────────────┘ └─────────────┘

Next, pick your platform 👉 Windows installLinux install