American Apparel has reached a deal in principle with its largest shareholder that will bring an infusion of cash and overhaul its board, an agreement that could bring an end to weeks of turmoil after the ouster of chief executive Dov Charney.

The Los Angeles retailer and Standard General, the New York hedge fund that controls a 43 percent stake in the company, have agreed to the terms of a deal that will also allow American Apparel to keep manufacturing in the United States, according to a person familiar with the negotiations. American Apparel executives have previously said the company's commitment to made in America is integral to its brand appeal and will continue.

The deal includes $25 million from Standard General that will allow American Apparel to pay off a loan of nearly $10 million from Lion Capital. Lion demanded repayment Monday, citing a provision in its lending agreement that allows the loan to be called in early if Charney stops working as chief executive.

As part of the agreement, the retailer's board will be revamped, with only co-chairmen Allan Mayer and David Danziger remaining, the person said.

The board voted Charney out as chairman and chief executive on June 18, pending an investigation into alleged misconduct. The vote immediately suspended him, but a 30-day wait was required before he could terminated.

Charney reached a deal with Standard General about two weeks ago to buy 27.4 million shares in American Apparel. Under the agreement, Standard General would buy the shares and then lend Charney the money to buy them, with the loan carrying a 10 percent annual interest rate.

Then last week, Standard General said in a letter to investors that its investment was designed to gain voting control over all of Charney's stock, and that it was in discussions with American Apparel to shore up its management and finances, and "restore the company to health."

It remains to be seen whether Charney will play a part in the future of American Apparel.

In the letter last week, Standard General said Charney had agreed to refrain from seeking any leadership role in American Apparel until the retailer's investigation into his conduct has concluded. The investment firm said its deal with Charney is not "an endorsement of him."

American Apparel is looking into allegations against Charney including misuse of company funds and apartments, and allowing the posting online of nude photos of a former employee who was suing him.

"He will serve no role if he is deemed unfit," Standard General said in its letter.