/// <summary> /// Adds a child file entry /// </summary> /// <param name="child">The child file entry</param> public void AddChild(FileEntry child) { Children.Add(child); }
/// <include file='.\BusyBox.xml' path='/BusyBox/Install/*'/> public bool Install(String busybox) { busybox.ThrowIfNullOrWhiteSpace("busybox"); FileEntry bb = null; try { Device.ExecuteShellCommand(BUSYBOX_COMMAND, null); return(true); } catch { // we are just checking if it is already installed so we really expect it to wind up here. } try { MountPoint mp = Device.MountPoints["/data"]; bool isRO = mp.IsReadOnly; Device.RemountMountPoint(Device.MountPoints["/data"], false); FileEntry path = null; try { path = this.fileListingService.FindFileEntry(BUSYBOX_BIN); } catch (FileNotFoundException) { // path doesn't exist, so we make it. this.fileSystem.MakeDirectory(BUSYBOX_BIN); // attempt to get the FileEntry after the directory has been made path = this.fileListingService.FindFileEntry(BUSYBOX_BIN); } this.fileSystem.Chmod(path.FullPath, "0755"); String bbPath = LinuxPath.Combine(path.FullPath, BUSYBOX_COMMAND); this.fileSystem.Copy(busybox, bbPath); bb = this.fileListingService.FindFileEntry(bbPath); this.fileSystem.Chmod(bb.FullPath, "0755"); Device.ExecuteShellCommand("{0}/busybox --install {0}", new ConsoleOutputReceiver( ), path.FullPath); // check if this path exists in the path already if (Device.EnvironmentVariables.ContainsKey("PATH")) { var paths = Device.EnvironmentVariables["PATH"].Split(':'); var found = paths.Where(p => String.Compare(p, BUSYBOX_BIN, false) == 0).Count( ) > 0; // we didnt find it, so add it. if (!found) { // this doesn't seem to actually work Device.ExecuteShellCommand(@"echo \ Mad Bee buxybox >> /init.rc", null); Device.ExecuteShellCommand(@"echo export PATH={0}:\$PATH >> /init.rc", null, BUSYBOX_BIN); } } if (mp.IsReadOnly != isRO) { // Put it back, if we changed it Device.RemountMountPoint(mp, isRO); } Device.ExecuteShellCommand("sync", null); } catch (Exception) { throw; } CheckForBusyBox( ); return(true); }