$mntpath = query("/runtime/device/storage/disk/entry:1/mntp") . "/"; } else { $mntpath = $mnt_root . "/"; } fwrite("a", $START, "xmldbc -s /itunes/server/sharepath \"/\"\n"); } if ($sd_status == "inactive") { fwrite("a", $START, "echo \"No HD found\" > /dev/console\n"); $mdirty = setup_mdns("MDNSRESPONDER.ITUNES", "0", null, null); } else { if ($active != "1") { fwrite("a", $START, "echo \"itunes server is disabled !\" > /dev/console\n"); $mdirty = setup_mdns("MDNSRESPONDER.ITUNES", "0", null, null); } else { fwrite("a", $START, "rm -rf " . $mntpath . ".systemfile/\n"); $mdirty = setup_mdns("MDNSRESPONDER.ITUNES", $port, $srvname, $srvcfg); fwrite("w", $ITUNES_CONF, "web_root /etc/admin-root\n"); fwrite("a", $ITUNES_CONF, "port 3689\n"); fwrite("a", $ITUNES_CONF, "admin_pw vykvkhvkhvilhbn1561\n"); fwrite("a", $ITUNES_CONF, "mp3_dir " . $sharepath . "\n"); fwrite("a", $ITUNES_CONF, "servername " . $srvname . "\n"); fwrite("a", $ITUNES_CONF, "runas root\n"); fwrite("a", $ITUNES_CONF, "playlist /etc/mt-daapd.playlist\n"); fwrite("a", $ITUNES_CONF, "extensions .mp3,.m4a,.m4p\n"); fwrite("a", $ITUNES_CONF, "db_dir " . $mntpath . ".systemfile/\n"); fwrite("a", $ITUNES_CONF, "rescan_interval 0\n"); fwrite("a", $ITUNES_CONF, "scan_type 0\n"); fwrite("a", $ITUNES_CONF, "always_scan 1\n"); //fwrite("a", $ITUNES_CONF, "logfile /var/log/mt-daapd.log\n"); fwrite("a", $ITUNES_CONF, "process_m3u 0\n"); fwrite("a", $ITUNES_CONF, "compress 0\n");
$port = "548"; $product = query("/runtime/device/modelname"); $srvname = "D-Link " . $product; $srvcfg = "_afpovertcp._tcp. local."; $mdirty = setup_mdns("MDNSRESPONDER.NETATALK", $port, $srvname, $srvcfg); $active = query("/netatalk/active"); $sharepath = query("/runtime/device/storage/disk/entry/mntp"); $AFPD_CONF = "/var/afpd.conf"; $APPLE_VOLUME_CONF = "/var/AppleVolumes.default"; $stsp = XNODE_getpathbytarget("/inet", "entry", "uid", "INET-1", 0); $ipaddr = query($stsp . "/ipv4/ipaddr"); $afpd_cmd = "" . $product . " -tcp -unixcodepage UTF8 -ipaddr " . $ipaddr . " -uamlist uams_guest.so -nosavepassword -defaultvol " . $APPLE_VOLUME_CONF . " -systemvol /etc/AppleVolumes.system -uservol -uampath /lib\n"; $vol_cmd = "" . $sharepath . " " . $product . " perm:0777 options:usedots,tm dbpath:" . $sharepath . " cnidscheme:dbd\n"; if ($active == "1") { fwrite("w", $AFPD_CONF, "" . $afpd_cmd . "\n"); fwrite("w", $APPLE_VOLUME_CONF, "" . $vol_cmd . "\n"); fwrite("a", $START, "mkdir /var/lock\n"); fwrite("a", $START, "cnid_metad -d -s cnid_dbd &\n"); fwrite("a", $START, "afpd -F " . $AFPD_CONF . "&\n"); if ($mdirty > 0) { fwrite("a", $START, "service MDNSRESPONDER restart"); } fwrite("a", $STOP, "echo \"Netatalk is disabled !\" > /dev/console\n"); fwrite("a", $STOP, "killall -9 afpd\n"); fwrite("a", $STOP, "killall -9 cnid_metad\n"); } else { $mdirty = setup_mdns("MDNSRESPONDER.NETATALK", "0", null, null); if ($mdirty > 0) { fwrite("a", $STOP, "service MDNSRESPONDER restart"); } }